Button to hide buttons when going to print spreadsheet?

cloudforgiven

New Member
Joined
Nov 21, 2016
Messages
21
Hi I have a few buttons in my spreadsheet to add rows and columns based on the users input. Now When I go to print my spreadsheet these buttons appear in the PRINT PREVIEW. Now instead of manually deleting the buttons every time I have to print, how can I hide them using with another BUTTON?
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

FDibbins

Well-known Member
Joined
Feb 16, 2013
Messages
6,723
Have you tried to set the range to just what you want to print> This is what I have done before when I have buttons that do stuff, but that don't need to be printed
 
Upvote 0

cloudforgiven

New Member
Joined
Nov 21, 2016
Messages
21
What do you mean range? I am printing a table and the table is not always the same size in terms of columns and rows? Unless the range function doesn't care about the table size?
 
Upvote 0

cloudforgiven

New Member
Joined
Nov 21, 2016
Messages
21
Ah I figured the range stuff out. but is there a way to do this meaning having a button to select the entire table?, when the table is constantly changing sizes?
 
Upvote 0

FDibbins

Well-known Member
Joined
Feb 16, 2013
Messages
6,723
You can set the range in the Print options
Perhaps include 1 extra (blank) column at the side of your range, and set the print range to use that. Then, if you need to insert columns, that range should adjust automatically
 
Upvote 0

cloudforgiven

New Member
Joined
Nov 21, 2016
Messages
21
can this be implemented into a button? meaning the button selects the entire table then brings up the print menu? May I get a sample code?
 
Upvote 0

FDibbins

Well-known Member
Joined
Feb 16, 2013
Messages
6,723
The way I described will not need to be included anywhere
 
Upvote 0

cloudforgiven

New Member
Joined
Nov 21, 2016
Messages
21
Its for my boss and for other people to use. They will be the ones to print it, and making a button to do this makes it easier for them(there useless when it comes to computers), than telling them select the table, go to print, then hit print selection. Using a button to do all of those 3 things is better, since its my reputation that will be on the line. Was hoping if you could give me some links or a sample code?

I know how to seclect the entire table its

ActiveSheet.ListObjects("Table1").Range.Select

now I need to make it go into print preview so that they can print? Any ideas?
 
Last edited:
Upvote 0

FDibbins

Well-known Member
Joined
Feb 16, 2013
Messages
6,723
Once you have set the print range, you don't need to do it again.

Or, if you feel the need, set the range in the print button
 
Upvote 0

cloudforgiven

New Member
Joined
Nov 21, 2016
Messages
21
Ye I figured it out its just 2 lines of code :),

ActiveSheet.ListObjects("Table1").Range.Select 'selects the entire table since its only 1 on the sheet'
Range("Table1").PrintOut 'then just print lol'
 
Last edited:
Upvote 0

Forum statistics

Threads
1,191,708
Messages
5,988,232
Members
440,139
Latest member
ngaicuong2017

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
Top