Microsoft Office Tutorials and References
In Depth Information
Try It
‘Toggle between views based on the button’s captions
‘to determine which view is next in the cycle.
If .Caption = “SHOW ALL” Then
With Range(“A5:G18”)
.EntireColumn.Hidden = False
.EntireRow.Hidden = False
End With
.Caption = “MONTH TOTALS”
ElseIf .Caption = “MONTH TOTALS” Then
Range(“B:F”).EntireColumn.Hidden = True
.Caption = “ITEM TOTALS”
ElseIf .Caption = “ITEM TOTALS” Then
Range(“B:F”).EntireColumn.Hidden = False
Rows(“6:17”).Hidden = True
.Caption = “SHOW ALL”
End If ‘for evaluating the button caption.
‘Close the With structure for Application.Caller.
End With
‘Turn ScreenUpdating on again.
Application.ScreenUpdating = True
End Sub
18.
Press Alt+Q to return to the worksheet.
19.
Draw a Forms button onto your worksheet at the top of column A. When you release the
mouse button you’ll see the Assign Macro dialog box. Select the macro named ToggleViews
and click the OK button as shown in Figure 13-24.
figurE 13-24
 
Search JabSto ::




Custom Search