• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA Button for print selection

barry2104

New Member
I have the attached worksheet where I have a hundreds of rows, sorted by time/date (column A). The secondary sorting is alphabetically by LKW (column D), but this doesn’t play a role in my question/request.
I often want to print out the rows for either today’s date or for tomorrow – e.g. there are 30 rows with todays date and 27 rows with tomorrow’s date in column A. After selecting the rows with today’s date I then press Ctrl+P and in these settings I choose: „only print the current selection“ (instead of „Print Active Sheets or Entire Workbook“).
I then get the PDF or paper print desired.

I want to insert a VBA Button which speeds things up!
Somewhere in row 1 i can place this button which has text inside it saying „print today“, which automatically does the row selection for me, then does the Ctrl+P command for me, and selects the setting „Print Selection“ for me also (if possible, but this last part is just a „nice to have“ because Excel remembers my last used print settings which, for this workbook, will always be „print selection“).

As I have never used VBA before, I’m hoping someone here can help me out
If I can get a button to work for „print today“ then I’d like to duplicate it for a second button: „print tomorrow“

cheers
 

Attachments

  • Tiefladerplan-2020.xls
    482.5 KB · Views: 4
barry2104
Before any Macros or so ...
Have You tried to use 'Filter'-option?
Screenshot 2020-06-02 at 19.09.34.png
There are ready many of Your needed selections.

And
if PrintRange is A:I then ... just 'Print' or even Save as PDF.

After You have tested 'semi-manual' procedure - You could do Your dreaming buttons.
eg with Macro Recorder ... You can do it!
 
Thanks, that is a good tip. I have now recorded my "today" and "tomorrow" macros and have assigned a shortcut to each of them and it works fine.
I tried assigning an ActiveX button to them but this didn't work, but shortcuts are enough of a help anyway
 
Back
Top