Unselect cells after Printing Dialog

DouweK

New Member
Joined
Sep 29, 2016
Messages
2
Dear all,

I've been using VBA's for a while now. But there is one simple thing I am not able to solve and google doesn't help.

I have have financial reports in several sheets with all the same layout. From all sheets I want to print only the range A1:N68
The following code helps me to print all selected sheets.

Code:
Sub Print_selection()
'
' Print_selection Macro
'
    Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4").Select
    Range("A1:N68").Select
    res = Application.Dialogs(xlDialogPrint).Show(, , , , , , , , , , , 1)
    
End Sub

This works.
But now I would like to unselect all these sheets after I close the printing dialog. Because now, all these sheets are selected and when I start typing, it is adjusting on all sheets if you forget to unselect them.

Any ideas?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
There are a couple of ways .. you could select another range but that leaves you with a similar problem

or you could use Application.CutCopyMode = False

or (I'm guessing here) you could define the print area in another way rather than by selection
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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