![]() |
Selecting a variable print area in a macro
I need to be able to select a variable print area in a macro.
every time I use the macro I need to be able to highlight a different range for printing. When recording the macro I entered in a range ("B5:G23") but now I need that to be a selectable variable before I print. |
Selecting a variable print area in a macro
Dim myRng as range
set myRng = nothing on error resume next set myrng = application.inputbox(Prompt:="Select a range", type:=8) on error goto 0 if myrng is nothing then msgbox "Try again later" 'user hit cancel else myrng.printout end if Surrealest wrote: I need to be able to select a variable print area in a macro. every time I use the macro I need to be able to highlight a different range for printing. When recording the macro I entered in a range ("B5:G23") but now I need that to be a selectable variable before I print. -- Dave Peterson |
Selecting a variable print area in a macro
That worked wonders. Thank you very much
"Dave Peterson" wrote: Dim myRng as range set myRng = nothing on error resume next set myrng = application.inputbox(Prompt:="Select a range", type:=8) on error goto 0 if myrng is nothing then msgbox "Try again later" 'user hit cancel else myrng.printout end if Surrealest wrote: I need to be able to select a variable print area in a macro. every time I use the macro I need to be able to highlight a different range for printing. When recording the macro I entered in a range ("B5:G23") but now I need that to be a selectable variable before I print. -- Dave Peterson |
All times are GMT +1. The time now is 02:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com