Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a macro in excel that fills a formula in the first cell in a
column, then copies that formula and fills it into the rest of the column. There is placeholder data in this column, so that the formula will only be copied to a certain amount of cells. My code looks like this: Range("P2").Select ActiveCell.FormulaR1C1 = "=Miles(RC[-10],RC[-5])" Range("P2").Select Selection.Copy Range("P2").Select Range(Selection, Selection.End(xlDown)).Select ActiveSheet.Paste Range("P2").Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Now the code works fine, but for some reason it pastes the formula well past the data that is in the column (ex. if data is in rows 1-42, the formula gets copied to rows 1-112) which gives me a bunch of "#N/A"s, which causes problems when I try to sum up these values. Any idea why this is happening? I thought putting in "xlDown" was supposed to prevent this problem... |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
End(xlDown) won't work | Excel Programming | |||
xlDown stops at next empty cell, not at last row of data | Excel Programming | |||
repeated end(xldown) | Excel Programming | |||
XlDown: Go to next blank row | Excel Programming | |||
xldown and xlright | Excel Programming |