Printing Hidden Cells

andrewb90

Well-known Member
Joined
Dec 16, 2009
Messages
1,077
I am sure this is pretty simple, but I am unsure how to do this. I would like to create a button to print out certain cells, most of which are hidden. How do I go about doing this?

Thanks,

Andrew
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi Andrew
Which cells do you want to print out ?
Is the sheet hidden, or just rows and columns ?
 
Upvote 0
It is just rows and columns hidden. For one of the buttons, I would want to print out B65:B113 and the same in columns C,D,E,F, and G
 
Upvote 0
Andrew
try this for B65:B113 and then copy to suit other ranges

Code:
Sub Macro1()
    Cells.EntireRow.Hidden = False
    Cells.EntireColumn.Hidden = False
    Range("B65:B113").PrintOut Copies:=1
    Columns("B:B").Hidden = True
    Rows("65:113").Hidden = True
End Sub
 
Upvote 0
Right click on the Sheet Tab and select View Code
Select "This Workbook" in the LH window
Paste the code in the RH window, Press ALT + F11 to go back to the Workbook
If you have created a button on the worksheet, Right click on it and select Assign Macro
Select the macro from the list and then OK

The next time you click the button the macro will run
 
Upvote 0
So I got a button and assigned it a macro, but after printing some of my columns get hidden. (depending on what is selected in line 5) The worksheet will be locked and the users will be unable to hide or unhide pages, and in any case I don't want those columns to be hidden as they are visible to start with. The stuff that I will be printing will be in hidden rows. In order to print to they have to be unhidden? Or can they automatically unhide, print and then rehide?

Thanks!

Andrew
 
Upvote 0
Andrew
The code I provided Unhides Rows and columns, prints the ranges and then rehides rows and columns, which I though was what you required.
 
Upvote 0
greetings MM. happy new year from us down south :)
 
Upvote 0
Cheers diddi....hope yours is safe and dry too !!
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,521
Members
449,088
Latest member
RandomExceller01

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