using vlookup to loop for a range of cells

vranjit138

Board Regular
Joined
Dec 18, 2006
Messages
146
Office Version
  1. 365
Platform
  1. Windows
hi friends

I have Invoice Numbers starting from range A1 to A4450 and in range B1 onwards i have Vendor Names . in the Vendor Report which begins in Range D6:d450, i have the invoice numbers and i require the vendor names there.. and i have to get the result for invoices in range D6:D450
in column E. how can i get the vlookup values by click of a button . the control button is taken from control toolbox

Please help

Regards
Ranjit
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi
Paste the following codes in the macro window ( Alt F11)
Code:
Sub vendor()
For a = 6 To 450
Cells(a, 5) = Application.WorksheetFunction.VLookup(Cells(a, 4), Range("A1:B4450"), 2, False)
Next a
End Sub
Run the macro. It will lookup invoice numbers of colD in col A and returns matching vendor name in col E
Ravi
 
Upvote 0
Why loop?
Code:
Private Sub CommandButton1_Click()
With Range("e6:e450")
     .Formula = "=vlookup(d6,$a$1:$b$4450,2,false)"
     .Value = .Value
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,810
Messages
6,121,690
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top