Printing Selected Sheets macro

Raleyoz

New Member
Joined
Aug 20, 2008
Messages
4
I have been trying to solve an issue i have with a macro, which i am a complete noob, could someone solve this for me

i need a button on a main worksheet to search all 80 worksheets within the same workbook and print each worksheet that (a1)= "Client"
sheets can be printed as single print

If at all possible is would be great if could filter data associated with "client" from 2 other options

I have searched high and low and nothing seems the same type of problems

thanks in advance

Tony:confused:
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hello Tony,

You can attach this macro to your button on the main sheet. The second part of the macro, filtering the data based on 2 conditions, can be added later. You didn't say what or where the conditions are and what cells will be filtered.
Code:
Sub PrintWorksheets()
  Dim Wks As Worksheet
 
    For Each Wks In Worksheets
      If Wks.Cells(1, "A").Value = "Client" Then
        Wks.PrintOut
      End If
    Next Wks
Sincerely,
Leith Ross
 
Upvote 0
Hi Leith

thanks for responding

I added a button and added the Macro, but i have recieved a runtime error 13, not sure if i have messed it up , i just copied it in to macro

If i can send any more info please advise

Tony
 
Last edited:
Upvote 0
Hello Tony,

You shouldn't be getting a "Type Mismatch" error. Can you post your workbook for review?

Sincerely,
Leith Ross
 
Upvote 0
As an addition to Leith's code

Rich (BB code):
Sub PrintWorksheets()
  Dim Wks As Worksheet
 
    For Each Wks In ActiveWorkbook.Worksheets
      If Wks.Cells(1, "A").Value = "Client" Then
        Wks.PrintOut
      End If
    Next Wks
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,754
Messages
6,174,314
Members
452,554
Latest member
Louis1225

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