Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default autofill with variables trouble

Hello--I am trying to work a macro using autofill an area with formula
R1C1 using variables. Strangely, I can get the thing to work for rows
but not for columns. I am sure I am missing something obvious. Can
anybody see what I am doing wrong?


distance, rowcount and colcount are all variables dimmed to integers

'set up the R1C1
ActiveCell.FormulaR1C1 = "=R[-" & distance & "]C"

'Autofill
ActiveCell.AutoFill _
Destination:=ActiveCell.Resize(rowcount - 4, colcount - 1 ),
Type:=xlFillDefault

I am banging my head against the wall and would love some help.
-Abe

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default autofill with variables trouble

Try recording a macro. If you are trying to fill rows and columns
simultaneously I don't think you can do it that way. You will need to fill
ActiveCell across the columns first, then those columns down the rows next,
in two steps. (Or down the rows first and across the columns next).

" wrote:

Hello--I am trying to work a macro using autofill an area with formula
R1C1 using variables. Strangely, I can get the thing to work for rows
but not for columns. I am sure I am missing something obvious. Can
anybody see what I am doing wrong?


distance, rowcount and colcount are all variables dimmed to integers

'set up the R1C1
ActiveCell.FormulaR1C1 = "=R[-" & distance & "]C"

'Autofill
ActiveCell.AutoFill _
Destination:=ActiveCell.Resize(rowcount - 4, colcount - 1 ),
Type:=xlFillDefault

I am banging my head against the wall and would love some help.
-Abe


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
Not at all clear on use of variables and/or object variables JMay-Rke Excel Discussion (Misc queries) 11 July 4th 08 06:36 PM
Trouble Graphing 1 point w/ 2 variables Will Charts and Charting in Excel 2 January 8th 07 11:37 PM
Autofill: Need to autofill one week block, (5) weekday only into cells. dstock Excel Discussion (Misc queries) 1 June 17th 05 08:21 PM
Q. Autofill question: Can I autofill alpha characters like I can numbers? George[_22_] Excel Programming 5 August 7th 04 10:33 AM
I'm having some trouble with variables in Excel '97... Mike-hime Excel Programming 5 January 7th 04 03:50 PM


All times are GMT +1. The time now is 12:15 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"