ndendrinos
Well-known Member
- Joined
- Jan 17, 2003
- Messages
- 1,694
Code:
Sub test()
Sheet1.Select
Range("A1:B8").Select
Application.CutCopyMode = False
Selection.Copy
Sheet2.Select
Dim LastCell As Range
With ActiveSheet
Set LastCell = .Cells(.Rows.Count, "A").End(xlUp)
If IsEmpty(LastCell) Then
'do nothing
Else
Set LastCell = LastCell.Offset(1, 0)
LastCell.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End If
End With
End Sub
Hello, Above code finds the first empty row in Sheet2 and pastes the selection from Sheet1.
I want to add to the code so that it pastes to the last empty row then continues upwards to the next empty row and pastes again and again until it cannot find any empty rows any more.
thank you