picture to illustrate what is happening after command button code is ran:
the code: (after which point it leaves the two text frames "selected")
Thank you.
the code: (after which point it leaves the two text frames "selected")
VBA Code:
Private Sub cmdColumnO_Click()
'
Application.DisplayAlerts = False
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.EnableEvents = False
'
If ActiveSheet.Shapes("lblColumnO1").TextFrame.Characters.Text = "UNHIDE" Then
cmdColumnO.Visible = False
cmdColumnO.Visible = True
'
ActiveSheet.Columns("M:O").ColumnWidth = 0.83
ActiveSheet.Shapes("lblColumnO1").TextFrame.Characters.Text = "HIDE"
ActiveSheet.Shapes.Range(Array("lblColumnO2", "lblColumnO1")).Select
With Selection.ShapeRange.TextFrame2.TextRange.Font.Fill
.ForeColor.RGB = RGB(0, 0, 255)
.Transparency = 0
.Solid
End With
'
Application.GoTo Reference:=Range("b1"), Scroll:=True
'
Else
'
ActiveSheet.Columns("M:O").EntireColumn.Hidden = True
ActiveSheet.Shapes("lblColumnO1").TextFrame.Characters.Text = "UNHIDE"
ActiveSheet.Shapes.Range(Array("lblColumnO2", "lblColumnO1")).Select
With Selection.ShapeRange.TextFrame2.TextRange.Font.Fill
.ForeColor.RGB = RGB(127, 127, 127)
.Transparency = 0
.Solid
End With
'
cmdColumnO.Visible = False
cmdColumnO.Visible = True
'
End If
'
ActiveWindow.Zoom = 115
'
Application.GoTo Reference:=Range("b1"), Scroll:=True
'
Application.DisplayAlerts = True
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.EnableEvents = True
'
End Sub
Thank you.