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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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,215,427
Messages
6,124,831
Members
449,190
Latest member
rscraig11

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