Relative range syntax

B

Bythsx-Addagio

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
 
S

Stefi

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:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top