autofill with variables trouble

  • Thread starter Thread starter akh2103
  • Start date Start date
A

akh2103

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
 
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).
 

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

Back
Top