View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default Relative range syntax

Try this (not tested):
Cells(4, g + 2).AutoFill Destination:=Range(Cells(4, g + 2), Cells(14, g
+ 2)), Type:=xlFillDefault
Regards,
Stefi

Bythsx-Addagio ezt *rta:

Hello,

I am running a loop which inserts a formula across cells in row 4 depending
on the value of g. I then would like to auto fill that formula down to the
below 14 rows.
ex. for column B.
Cells(4, g + 2).AutoFill Destination:=Range("B4:B18"), Type:=xlFillDefault

How can I write this so I can use the active column instead of the static
"B4:B14"

I was thinking of setting a range by:
set rng1 = range(R[1]C:R[14]C)

Then
Cells(4, g + 2).AutoFill Destination:=rng1, Type:=xlFillDefault

It doesn't work however. Any suggestions?

Thanks