tristaniceph
New Member
- Joined
- Sep 5, 2022
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
VBA Code:
Sub PrintAll()
Dim i As Long, LastRow As Long
LastRow = Worksheets("Names").Range("A65536").End(xlUp).Row
For i = 1 To LastRow
Worksheets("Form").Range("A1").Value = Worksheets("Names").Range("A" & i).Value
Worksheets("Form").Range("Print_Me").PrintOut
Next i
End Sub
I have found the above code as to replace the cell value on the form with a list with names, and print the form with each name, it works perfectly.
However, I need to print 3 tabs instead of 1 tab, and if the 2nd tab does not have any value in a column, that page should be ignored.
Namely:
1st tab: must print;
2nd tab: if no value, don't print;
3rd tab, must print.
May I ask how can I amend this code please? I'm a beginner on VBA, would very much appreciated if anyone could give me a hand please.