Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Place a togglebutton from the Control Toolbox Toolbar on the worksheet where
you want this behavior. double click on it to get to the click event, then modify it to look similar to this: Private Sub ToggleButton1_Click() sSh = "'" & ActiveSheet.Name & "'!" If ToggleButton1.Value Then ToggleButton1.Caption = "A1:A6" ActiveSheet.PageSetup.PrintArea = _ sSh & "A1:A6" Else ToggleButton1.Caption = "A1:A20" ActiveSheet.PageSetup.PrintArea = _ sSh & "A1:A20" End If End Sub in the dropdowns a the top, select Worksheet and Activate put in code like this: Private Sub Worksheet_Activate() If ToggleButton1.Value Then ToggleButton1.Caption = "A1:A6" ActiveSheet.PageSetup.PrintArea = _ sSh & "A1:A6" Else ToggleButton1.Caption = "A1:A20" ActiveSheet.PageSetup.PrintArea = _ sSh & "A1:A20" End If End Sub Depending on what the user can do, you might need to put that code in the selectionchange event rather than the activate event. As written, the caption shows the current PrintArea setting. This seems most intutitive to me. Modify to suite you individual situation. -- Regards, Tom Ogilvy "John Davies" wrote in message ... At times I need to print a different section of a spreadsheet. Is it possible to set up a toggle button to set the area for printing? For example to print cells a1:a6 you would click on the button once but to print cells a1:a20 you would click on it again. Thanks in advance of a favourable reply. Regards John D |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
set area in excel not giving me option to set print area? | Excel Discussion (Misc queries) | |||
File, print area, clear area, is not working | New Users to Excel | |||
Macro - Set Print Area for Changing Data Area | Excel Programming | |||
How do you turn off a print area for a page? (no print area) | Excel Discussion (Misc queries) | |||
Adding .xla button for Toggle Calculation Button | Excel Programming |