Print Hidden column with my print function

jimjaix

Board Regular
Joined
Mar 11, 2009
Messages
58
Hi, thanks VoG for the following print function

Code:
Private Sub CommandButton2_Click()
With ActiveSheet
    .PageSetup.PrintArea = "B3:F120"
    .PrintOut
End With
End Sub

With this print function I want print the hidden columns, I have B to F and D:F are hidden, how do I hit the print button and then print B:F even thought they are hidden? Thanks
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Try

Code:
Private Sub CommandButton2_Click()
With ActiveSheet
    .Columns("B:F").Hidden = False
    .PageSetup.PrintArea = "B3:F120"
    .PrintPreview
    .Columns("B:F").Hidden = True
End With
End Sub
 
Upvote 0
Very sweet, it shows me the print preview. Is there a way I can put a printing Title into the VBA?

Try

Code:
Private Sub CommandButton2_Click()
With ActiveSheet
    .Columns("B:F").Hidden = False
    .PageSetup.PrintArea = "B3:F120"
    .PrintPreview
    .Columns("B:F").Hidden = True
End With
End Sub
 
Upvote 0
I set the print title under Page Setup, I want to know if I can embed that into the print button, let's say one button says Print CDTS, I want the title to be "Time in / Time out Sheet CDTS" and then my second button is LDP so I want it to be ""Time in / Time out Sheet Latino" if I can do that it would be so cool.

Oops! Change .PrintPreview to .Printout

Where do you want the title - as a header?
 
Upvote 0
Try

Code:
Private Sub CommandButton2_Click()
With ActiveSheet
    .Columns("B:F").Hidden = False
    .PageSetup.PrintArea = "B3:F120"
    .PageSetup.CenterHeader = "Time in / Time out Sheet CDTS"
    .PrintOut
    .Columns("B:F").Hidden = True
End With
End Sub
 
Upvote 0
This is amazing, it works. Thanks a lot VoG
Try

Code:
Private Sub CommandButton2_Click()
With ActiveSheet
    .Columns("B:F").Hidden = False
    .PageSetup.PrintArea = "B3:F120"
    .PageSetup.CenterHeader = "Time in / Time out Sheet CDTS"
    .PrintOut
    .Columns("B:F").Hidden = True
End With
End Sub

P.S. AMAZING PEOPLE ON THIS WEBSITE
 
Upvote 0

Forum statistics

Threads
1,214,596
Messages
6,120,438
Members
448,966
Latest member
DannyC96

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