Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I should first explain that the AutoFill method only works starting from the
selected cell, i.e. if "M2" is where your formula is then you can only autofill up, down, left, or right from cell "M2". Example: Range("M2").Select Selection.AutoFill Destination:=Range("M2:M15"), Type:=xlFillDefault If you want to copy the formula in "M2" to "A5" (and beyond) you must first copy the formula to "A5" and then autofill down the "A" column Range("A5").Formula = Range("M2").Formula Range("A5").Select Selection.AutoFill Destination:=Range( <put your range in here ), Type:=xlFillDefault and insert the fill range in the format "A5:A999" or Cells(5, "A"), Cells(999, "A") etc. I'll leave it to you to calculate the row range. I need to hit the road for the day. Bye "Emily" wrote: Hi Charlie, I used your syntax as follows: Range("M2").Select Selection.AutoFill Destination:=Range(Cells(5, 1), Cells(iNumOfRows + 1, 1)), Type:=xlFillDefault However, I got an error when I ran the macro, "Runtime error '1004'. Autofill method of Range class failed". Any advice on how to get rid of this error? Thanks! -Emily |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula Problem in Macro | Excel Discussion (Misc queries) | |||
Put a formula to a cell with macro and it doesent calculate. (Excel localisation problem?) | Excel Programming | |||
Problem in updating all worksheets of a workbook using a macro that calls another macro | Excel Programming | |||
Macro Formula Updating Problem | Excel Programming | |||
Excel/macro Formula Problem! | Excel Programming |