Printing Selected Pages using Macro Button

BeginnerInExcel

New Member
Joined
Aug 18, 2022
Messages
1
Office Version
  1. 2013
Platform
  1. Windows
Hi Excel Wizards,

I've set up a new sheet that will act as monitoring sheet with criteria going across to column I. Based on the value in one cell (C6), the sheet will populate the below rows with dates. Column A populates with a Day number (0,1,2,3 etc) and Column B with the actual date. In order to do this columns A & B are therefore populated with formulas for generating the dates down to day 210.

The problem I have is that when I come to print. If we have need for a 7 day monitoring task, the spreadsheet will print a large number of pages when only 1 would be needed. This is I assume because there are formulas in all cells down to around 250. I would like to be able to have a print button that will run a macro that prints from the computers default printer and only prints pages on the sheet that have date values on them to save all the excess paper.

To aid this I've got a cell (I2) with the following formula that acts a page count for required number of pages to print.

=IF(C6="","",IF(C6>192,5,IF(C6>139,4,IF(C6>86,3,IF(C6>33,2,IF(C6>0,1))))))

While I'm ok with Excel formulas, VBA is an unknown to me and I have no idea how to get a macro that takes the value in cell I2 and translates that into an instruction to print that number of pages when clicking a print button. Any help that can be given would be appreciated!

A complete VBA novice.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

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