Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Relative range syntax

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax for a relative formula Ian Murphy Excel Worksheet Functions 2 September 8th 06 05:32 PM
Syntax help with range ZZBC Excel Programming 1 February 2nd 06 07:31 AM
How to get relative range? Jan Nademlejnsky[_2_] Excel Programming 5 February 25th 04 08:21 PM
syntax for relative cell change and looping BwanaP Excel Programming 1 September 27th 03 03:36 PM


All times are GMT +1. The time now is 09:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"