Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy and Paste Overlap
I have a macro that will look until it finds a 0 in
column A. Then it will copy that row to row 2. If row 2 contains a 0 in column A, I get an error. It says: "Run-time error '1004': This selection is not valid There are several possible reasons: -Copy and paste areas cannot overlap unless they're the same size and shape. -If you're using the Create command on the Name submenu of the Insert menu, the row or column containing the proposed names won't....." Here is my code: For n = 2 To FinalRow If (Range("A" & n).Value) = 0 Then Rows(n & ":" & n).Cut Rows("2:2").Insert Shift:=xlDown End If Next n Thank you |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy and Paste Overlap
Adam,
The simple solution is to start your loop at row 3, since there isn't any need to check row 2: all your code does is trying to do is move row 2 to row 2, so don't bother trying. HTH, Bernie MS Excel MVP "Adam" wrote in message ... I have a macro that will look until it finds a 0 in column A. Then it will copy that row to row 2. If row 2 contains a 0 in column A, I get an error. It says: "Run-time error '1004': This selection is not valid There are several possible reasons: -Copy and paste areas cannot overlap unless they're the same size and shape. -If you're using the Create command on the Name submenu of the Insert menu, the row or column containing the proposed names won't....." Here is my code: For n = 2 To FinalRow If (Range("A" & n).Value) = 0 Then Rows(n & ":" & n).Cut Rows("2:2").Insert Shift:=xlDown End If Next n Thank you |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can't Copy and Paste or Paste Special between Excel Workbooks | Excel Discussion (Misc queries) | |||
how copy formula that contains ranges so ranges do not overlap | Excel Worksheet Functions | |||
Copy; Paste; Paste Special are disabled | Excel Discussion (Misc queries) | |||
Excel cut/Paste Problem: Year changes after data is copy and paste | Excel Discussion (Misc queries) | |||
I cannot paste from one workbook to another. Copy works, paste do. | Excel Discussion (Misc queries) |