Print Area - Microsoft Community
Office / Excel / Microsoft Office Programming / Office 365 Home
how print non adjacent areas on single page?
hide ranges don't want print.
or use macro print selected or preset areas.
sub print_noncontiguous()
dim destrange range
dim smallrng range
dim newsh worksheet
dim ash worksheet
dim lr long
application.screenupdating = false
set ash = activesheet
set newsh = worksheets.add
ash.select
lr = 1
each smallrng in selection.areas
'you can use range more preset areas this
'for each smallrng in ash.range("a1:c1,d10:g20,a30:e41").areas
smallrng.copy
set destrange = newsh.cells(lr, 1)
destrange.pastespecial xlpastevalues
destrange.pastespecial xlpasteformats
lr = lr + smallrng.rows.count
next smallrng
newsh.columns.autofit
newsh.printout 'printpreview
application.displayalerts = false
newsh.delete
application.displayalerts = true
application.screenupdating = true
end sub
gord
Office / Excel / Microsoft Office Programming / Office 365 Home
Comments
Post a Comment