Sub
For i = 1 to lastrow
If Cells(i, 4).Value = "Income" Or Cells(i, 4).Value = "Expense" Then
Range("A" & i, "G" & i).Copy
Sheets("Trial WorkSheet").Select
Range("A1").Select
lastrow = Range("A1000000").End(xlUp).Row
ActiveCell.Offset(lastrow, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("General Journal").Select
End If
Next i
Application.ScreenUpdating = True
End Sub
The If Statement doesn’t work correctly the code move the Income data but doesn’t move the Expenses data.
What is wrong with the code?
Thank you
For i = 1 to lastrow
If Cells(i, 4).Value = "Income" Or Cells(i, 4).Value = "Expense" Then
Range("A" & i, "G" & i).Copy
Sheets("Trial WorkSheet").Select
Range("A1").Select
lastrow = Range("A1000000").End(xlUp).Row
ActiveCell.Offset(lastrow, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("General Journal").Select
End If
Next i
Application.ScreenUpdating = True
End Sub
The If Statement doesn’t work correctly the code move the Income data but doesn’t move the Expenses data.
What is wrong with the code?
Thank you