Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I guess I'll just record first and then fix later with the help of you
gracious people. Thanks. "Dave Peterson" wrote: That's the way recording macros works--it records the actions you take against the ranges you select. TRYING wrote: Thanks, Dave. I tried your first solution. The macro now works like I want it to. Follow-up question: Since I dont' know enough to write macros myself, I rely on macro recording. Why did my recorded macro fix the print range at $A$1:$E$209 instead of selecting the current region like it wanted it to do when I clicked on the Select Current Region icon during macro recording? "Dave Peterson" wrote: Sub DataPrint() ' ' DataPrint Macro ' ' Keyboard Shortcut: Ctrl+d ' Application.Goto Reference:="DataTopLeft" Selection.CurrentRegion.Select ActiveSheet.PageSetup.PrintArea = Selection.address ActiveWindow.SelectedSheets.PrintPreview End Sub Or without changing the printarea: activesheet.range("a1").currentregion.printpreview TRYING wrote: Sub DataPrint() ' ' DataPrint Macro ' ' Keyboard Shortcut: Ctrl+d ' Application.Goto Reference:="DataTopLeft" Selection.CurrentRegion.Select ActiveSheet.PageSetup.PrintArea = "$A$1:$E$209" ActiveWindow.SelectedSheets.PrintPreview End Sub Above is a macro I recorded. "DataTopLeft" is cell A1 which contains a non-printing apostrophe. When recording the macro I started by going to DataTopLeft. Then I clicked on Select Current Region icon which defined the region as "$A$1:$E$209". Then I clicked the Set Print Area icon. Then I clicked on the Print Preview icon. I then clicked the Stop Recording icon. The print area for next month could be A1 to E215 or A1 to E198 or some other area. How can I make the macro do what I want and what I thought I did when I recorded it, which is select the current range and set that as the print range? Thanks. -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I make a dynamic print range in excel? | Excel Discussion (Misc queries) | |||
macro code to get dynamic range | Excel Discussion (Misc queries) | |||
Dynamic range for autofill macro | Excel Discussion (Misc queries) | |||
How do I create a dynamic range in a macro | Excel Worksheet Functions | |||
Dynamic Print Range Help | Excel Worksheet Functions |