ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to delete columns and set print area (https://www.excelbanter.com/excel-programming/303305-macro-delete-columns-set-print-area.html)

twaccess[_12_]

Macro to delete columns and set print area
 
Does anyone have a macro that can delete a pre-set series of columns an
then set the page setup to print 1 page wide in Landscape format pleas
?

I.e. Delete columns b,c,d and f, then page setup to print 1 page wid
in landscape format.

I have a daily report which contains a number of columns which I don
need and I delete them normally before printing the report off to fi
to at least 1 page wide. The number of pages high is dependant on ho
long the report is

--
Message posted from http://www.ExcelForum.com


Rob van Gelder[_4_]

Macro to delete columns and set print area
 
Sub test()
Range("B:B,C:C,D:D,F:F").Delete xlShiftToLeft
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"twaccess " wrote in message
...
Does anyone have a macro that can delete a pre-set series of columns and
then set the page setup to print 1 page wide in Landscape format please
?

I.e. Delete columns b,c,d and f, then page setup to print 1 page wide
in landscape format.

I have a daily report which contains a number of columns which I dont
need and I delete them normally before printing the report off to fit
to at least 1 page wide. The number of pages high is dependant on how
long the report is.


---
Message posted from http://www.ExcelForum.com/




twaccess[_13_]

Macro to delete columns and set print area
 
Thanks very much for this Rob. It is much appreciated and will make m
daily life easier.

There is another bit of finesse though. What would the coding be t
autofit the column widths to the text as well please ?

Thanks

T

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 01:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com