Want code to copy to ABOVE row 22 column A on sheet 1
Hi Howard,
Am Sat, 29 Jun 2013 11:51:09 +0200 schrieb Claus Busch:
I don't know if I understood your handling with the gap. Gap after each
copied row or after the bundle of the 4 copied rows?
Now it is always after 4 rows a gap of 2 rows:
or a little bit shorter:
Sub test2()
Dim nRow As Integer
Dim myTarget As Range
With Sheets("Sheet1")
nRow = .Cells(21, 1).End(xlUp).Row
If 21 - (nRow + 6) < 4 Then
MsgBox "No more rows"
Exit Sub
End If
Set myTarget = IIf(nRow = 1, .Cells(nRow, 1), .Cells(nRow + 3, 1))
Range("A1:Z4").Copy myTarget
Range("A1:Z4").ClearContents
End With
End Sub
Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
|