View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Unknown Range in Macro

hi
key would be to find the last row in your range and assign it to a variable.
maybe....
Dim lr As Long
lr = Cells(Rows.Count, "R").End(xlUp).Row

then plug in....
Range("R4").AutoFill Destination:=Range("R4:R" & lr)
Range("R4:R" & lr).Select

regards
FSt1

"scone57" wrote:

Having trouble changing a fixed range to a variable range in VBA.
When creating the macro, I used a fixed range, but now need to change this
to a variable, for future spreadsheets.

Range("R4").Select
Selection.AutoFill Destination:=Range("R4:R886")
Range("R4:R886").Select

Can anyone help?