VBA Help in Macro

Tcoult20

New Member
Joined
Jun 11, 2014
Messages
1
Hey I am trying to run a macro that fill complete a v-lookup. The v-lookup is being ran in column C and its lookup value is coming from column A. The table array is coming from another workbook. I am wanting the v-lookup to run until it finds an empty cell in column A since the number of values in column A can differ every time. I recorded a macro that put a vlookup in and dragged it down, however it will only go down to the same amount of cells (ex: 300) every time. Here is the code I have as of now. Sub Vlookup()
'
' Vlookup Macro
'
'
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-2],'[Price File 6-1-14.xlsx]ARC'!C2:C17,16,FALSE)"
Selection.AutoFill Destination:=Range("C3:C300"), Type:=xlFillDefault
Range("C3:C300").Select

End Sub
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Welcome to the Board!

You can dynamically locate the last row in column A with data like this:
Code:
lastRow = Cells(Rows.Count,"A").End(xlUp).Row
You can then incorporate that into your VBA code, wherever you want to refer to the last row of data.
 
Upvote 0

Forum statistics

Threads
1,215,035
Messages
6,122,791
Members
449,095
Latest member
m_smith_solihull

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