View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] richard.lawn@gmail.com is offline
external usenet poster
 
Posts: 1
Default Excel Marco Fill Down Dynamic Range

Hello,

I am trying to run a vlookup through a macro but need the range to vary
depending on the numbers of rows of data (which will be different every
time).
Currently I have just used a fixed range in the code

Sub fillDownLookup()
Range("ah2").Select
ActiveCell.FormulaR1C1 =
"=VLOOKUP(RC[-13],Lookup!R2C6:R328C7,2,FALSE)"
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Range("AH2:AH4000").Select
Selection.FillDown
End Sub

I would appreciate any advice of sugguestions that would replace the
fixed "Range("AH2:AH4000")" with code for a dynamic range

cheers
R