Try This Code
Sub VlookupByCodes() Dim ResultRange As Range Dim SearchRange As Range Dim ColNum As Integer Dim LookUpValue As Range Dim cellResult As Range Dim CellSearch As Range Dim i As Integer Set ResultRange = Application.InputBox("Select the Range Where You want Output", , , , , , , 8) Set LookUpValue = Application.InputBox("Select the Range of searchable Value", , , , , , , 8) Set SearchRange = Application.InputBox("Select the Range to Search Value", , , , , , , 8) ColNum = Application.InputBox("Give Colnum") i = 1 For Each cellResult In ResultRange For Each CellSearch In SearchRange If CellSearch.Value = LookUpValue.Cells(i, 1).Value Then cellResult.Value = CellSearch.Offset(0, ColNum).Value i = i + 1 Exit For End If Next Next Set ResultRange = Nothing Set LookUpValue = Nothing Set SearchRange = Nothing Set cellResult = Nothing Set CellSearch = Nothing End Sub From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of Anil Bhange Sent: Friday, July 15, 2011 11:32 AM To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ VBA Code against VLOOKUP function Hi Masters, Needed the VBA code which work similar to VLOOKUP function where I can call data from master worksheet to fill my report Attached file will explain you my requirement Master worksheet contains - GL Code master where each GL code has details and grouping While putting GL code in Report worksheet it should call the data from master worksheet and give me Group 1 and Group 2 Please help Regards, Anil Bhange -- ---------------------------------------------------------------------------- ------ Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel