Here's an example that puts the Now()
value in column A.
Sub move()
Dim i As Integer
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim nextRow As Long
Dim copyRange As Range
Dim destRange As Range
Application.ScreenUpdating = False
Set sh1 = ActiveWorkbook.Worksheets("Sheet1")
Set sh2 = ActiveWorkbook.Worksheets("Sheet2")
Set copyRange = sh1.Range("A1:A5")
i = Application.WorksheetFunction.CountA(sh2.Range("B:B")) + 4
Set destRange = sh2.Range("B" & i)
destRange.Resize(1, copyRange.Rows.Count).Value = Application.Transpose(copyRange.Value)
destRange.Offset(0, -1).Value = Format(Now(), "MMM-DD-YYYY")
copyRange.Clear
Application.ScreenUpdating = True
End Sub
There are better ways of getting the last row in column B than using a While
loop, plenty of examples around here. Some are better than others but depend on what you're doing and what your worksheet structure looks like. I used one here which assumes that column B is ALL empty except the rows/records you're moving. If that's not the case, or if B1:B3
have some values in them, you'd need to modify or use another method. Or you could just use your loop, but I'd search for alternatives :)