Macro Print Help!

JohnsJL1

New Member
Joined
Jan 29, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi all. I am just beginning using macros (mostly thanks to your forums - THANK YOU!).
I have an order form that I am using the code below to print all rows that have input in Column A.

Sub PrintA()
'prints rows of data, will not print rows if column A is blank
Application.ScreenUpdating = False
Range("A:A").EntireRow.Hidden = False
Range("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Range("A:A").EntireRow.Hidden = False
Application.ScreenUpdating = True
End Sub

I would like to revise this to always include cells A1 to G6 in the print & exclude any material categories that does not have input in the corresponding cells for a certain range. An example of how it is currently printing is attached. Thank you!
 

Attachments

  • 1.png
    1.png
    24.8 KB · Views: 10

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
I found a work around to having the categories not print, but now when I print, it prints 7 blank pages due to the extent of all the rows that have data. Is there a way to not print the 7 blank pages?

Macro I am using to print is below:

CODE:
Sub PrintA()
'print range("A1:B5")'
'prints rows of data, will not print rows if column A is blank
Application.ScreenUpdating = False
Range("A8:A235").EntireRow.Hidden = False
Range("A8:A235").SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Range("A8:A235").EntireRow.Hidden = False
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,077
Messages
6,122,992
Members
449,094
Latest member
masterms

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