VBA macro for Replace cell value from a list THEN Print Multiple Tabs with Value

tristaniceph

New Member
Joined
Sep 5, 2022
Messages
1
Office Version
  1. 365
Platform
  1. 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.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top