Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am trying to copy a formula down a few cells in a column. I have the following code: Sheets("ReportOutput").Range("F4").Copy For i = 1 To NumRows Sheets("ReportOutput").Range((i + 3), 6).PasteSpecial xlPasteFormulas Next i the cell F4 already has the formula in it. When it runs, I get Runtime error 1004, Application defined or object-defined error If I go to the debug screen, its the paste line that is highlighted. If I replace the (i+3),6 with a normal ref. like "F6", it works... but I need to be able to loop through as I won't know beforehand how many rows of data there will be? NumRows is a variable with the no. of rows returned from a query - this works ok as prior to this bit of code I have another loop exactly the same to set some cell formats (which works). It seems I can use the (i+3,6) style reference on cells okay, but the pastespecial bit only works on a range, which doesnt like that method, so a bit of a catch 22. Help! James. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Variable Range for NPV | Excel Worksheet Functions | |||
Variable not working | Excel Discussion (Misc queries) | |||
setting a range variable equal to the value of a string variable | Excel Programming | |||
variable range: l just can't get there! | Excel Programming | |||
Problem trying to us a range variable as an array variable | Excel Programming |