Sub ToggleHeadingsGrids()
Dim gridMode&, headingsMode&
On Error Resume Next
headingsMode = ActiveWindow.DisplayHeadings
gridMode = ActiveWindow.DisplayGridlines
If headingsMode And Not gridMode Then
headingsMode = False
ElseIf Not headingsMode And Not gridMode Then
gridMode = True
ElseIf Not headingsMode And gridMode Then
headingsMode = True
Else
gridMode = False
End If
ActiveWindow.DisplayHeadings = headingsMode
ActiveWindow.DisplayGridlines = gridMode
End Sub
|