JonathanSass
New Member
- Joined
- Apr 15, 2021
- Messages
- 14
- Office Version
- 2019
Hi all,
I have tried to use the following code for my issue described in the header:
I am new to Excel VBA.
Thank you very much in advance!!
/Jonathan
I have tried to use the following code for my issue described in the header:
VBA Code:
Sub CopyDataToJournal()
Dim erow As Long, lastrow As Long, i As Long
lastrow = Sheets("Sheet1").Cells(Rows.Count, 12).End(xlUp).Row
For i = 4 To lastrow
If Sheet1.Cells(i, 12) <> "0" Then
Sheets("Sheet1").Range(Cells(i, 12), Cells(i, 13), Cells(i, 17), Cells(i, 18), Cells(i, 19), Cells(i, 20)).Copy
Sheets("JOURNAL").Activate
erow = JOURNAL.Cells(Row.Count, 1).End(xlUp).Offset(1, 0).Row
ActiveSheet.Paste Destination:=Sheets("JOURNAL").Range(Cells(erow, 1), Cells(erow, 2), Cells(erow, 6), Cells(erow, 7), Cells(erow, 8), Cells(erow, 9))
Sheets("Sheet1").Activate
End If
Next i
Application.CutCopyMode = False
End Sub
I am new to Excel VBA.
Thank you very much in advance!!
/Jonathan
Last edited by a moderator: