View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Adam[_9_] Adam[_9_] is offline
external usenet poster
 
Posts: 15
Default 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