View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
runsrealfast runsrealfast is offline
external usenet poster
 
Posts: 14
Default Help with Dynamically changing Range in Excel Macro

I have a macro that contains the following code:

Range("R2").Select
ActiveCell.FormulaR1C1 = "=VALUE(RC[-1])"
Range("R2").Select
Selection.AutoFill Destination:=Range("R2:R1006")

What I am doing is simply creating a formula in cell R2 (it will
always be in R2) and then auto filling to the last populated row. I am
struggling on how to change the part of the code that says
"Range("R2:R1006")". Every time this macro runs the number of rows
will not be 1006. How is it that I change this? TIA



John