Hi everyone. I have 5 rows currently residing in Column A in Sheet 1 that I would like to cut & paste into Column A in Sheet 2.
I am using the following macro below:
The rows residing in Column A (Sheet1) are in the order below:
specs:HDD=WD, GFX=Leadtek, Mouse=Logitech
specs:HDD=Seagate, GFX=Nvidia, Mouse=Hp
specs:HDD=WD, GFX=Leadtek, Mouse=Microsoft
specs:HDD=WD, GFX=Nvidia, Mouse=Dell
specs:HDD=Seagate, GFX=Asus, Mouse=Hp
Once I click the button in Sheet1, 4 rows get cut & pasted to Sheet2 and the following row below is left behind in Sheet1:
specs:HDD=Seagate, GFX=Nvidia, Mouse=Hp
I'm not sure why this is happening .. could someone please bring insight into why this is happening and how I can bring all 5 rows into Sheet2? Thank you for the help!
I am using the following macro below:
Code:
Sub Button1_Click()
Dim LastCell As Range
Dim LastCellRowNumber As Long
Dim Incremental As Integer
Sheets("Sheet1").Activate
For Each Cell In ActiveSheet.UsedRange.Cells
Set LastCell = Sheets("Sheet2").Cells(Rows.count, "A").End(xlUp)
LastCellRowNumber = LastCell.Row
'MsgBox LastCellRowNumber
Sheets("Sheet2").Activate
If (Range("A" & LastCellRowNumber).Text <> Empty) Then
Incremental = 1
Else
Incremental = 0
End If
Cell.Cut Sheets("Sheet2").Range("A" & LastCellRowNumber + Incremental)
Next
End Sub
The rows residing in Column A (Sheet1) are in the order below:
specs:HDD=WD, GFX=Leadtek, Mouse=Logitech
specs:HDD=Seagate, GFX=Nvidia, Mouse=Hp
specs:HDD=WD, GFX=Leadtek, Mouse=Microsoft
specs:HDD=WD, GFX=Nvidia, Mouse=Dell
specs:HDD=Seagate, GFX=Asus, Mouse=Hp
Once I click the button in Sheet1, 4 rows get cut & pasted to Sheet2 and the following row below is left behind in Sheet1:
specs:HDD=Seagate, GFX=Nvidia, Mouse=Hp
I'm not sure why this is happening .. could someone please bring insight into why this is happening and how I can bring all 5 rows into Sheet2? Thank you for the help!