Forum Discussion
QTr90
Jul 11, 2023Copper Contributor
Printing all the tabs in excel separately
Hi everyone, I'm using excel 365 version. I got the problem with my report file. The file contains multiple sheets, each sheet contains the transaction of 1 customer. When printing the report of ...
QTr90
Jul 17, 2023Copper Contributor
HansVogelaar I'm so sorry for bother again, but can you check if i wrote the marco correctly?. I'm using power query to generate the report in each sheet, and print only some particular sheets contains transactions data of these customers in a day, not the entire workbook:
Sub Printsheet()
Dim wsh As Worksheet
For Each wsh In Worksheets
If Range("A9").Value = 1 Or Range("A9").Value = "Paysend" Then
wsh.PrintOut
End If
Next wsh
End Sub
HansVogelaar
Jul 17, 2023MVP
Almost, but Range("A9").Value refers to the active sheet, not on wsh. Change the macro to
Sub Printsheet()
Dim wsh As Worksheet
For Each wsh In Worksheets
If wsh.Range("A9").Value = 1 Or wsh.Range("A9").Value = "Paysend" Then
wsh.PrintOut
End If
Next wsh
End Sub
cell A9 on