View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Charlie Charlie is offline
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