F
Fred
Excel 2000.
This my first attempt to use a Command button (from the Control Toolbox) and
neither Help nor Google have provided an obvious solution to my problem.
In a recent reply to another question, Gord Dibben suggested using a
worksheet event code to change the font colour in order to highlight data
entered when editing a worksheet. Gord then suggested that one way of
toggling this event code on or off could be to use a Command button.
The codes work perfectly but I cannot locate my new Command button
statically on the toolbar but only on the worksheet where it scrolls with
the sheet.
I cannot use a Custom button that will locate on the toolbar because they
are associated with macros and my coding knowledge is negligible.
Possible solutions might be:
i) Extend Gord's main code to include a "hotkey" type toggle switch.
ii) Some code to place a suitable button on a toolbar.
Gord's code:
CommandButton1
Private Sub CommandButton1_Click()
Application.EnableEvents = False = Not _
Application.EnableEvents = False
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Value <> "" Then
.Font.ColorIndex = 3
End If
End With
ws_exit:
Application.EnableEvents = True
End Sub
Any help or links would be greatly appreciated.
This my first attempt to use a Command button (from the Control Toolbox) and
neither Help nor Google have provided an obvious solution to my problem.
In a recent reply to another question, Gord Dibben suggested using a
worksheet event code to change the font colour in order to highlight data
entered when editing a worksheet. Gord then suggested that one way of
toggling this event code on or off could be to use a Command button.
The codes work perfectly but I cannot locate my new Command button
statically on the toolbar but only on the worksheet where it scrolls with
the sheet.
I cannot use a Custom button that will locate on the toolbar because they
are associated with macros and my coding knowledge is negligible.
Possible solutions might be:
i) Extend Gord's main code to include a "hotkey" type toggle switch.
ii) Some code to place a suitable button on a toolbar.
Gord's code:
CommandButton1
Private Sub CommandButton1_Click()
Application.EnableEvents = False = Not _
Application.EnableEvents = False
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Value <> "" Then
.Font.ColorIndex = 3
End If
End With
ws_exit:
Application.EnableEvents = True
End Sub
Any help or links would be greatly appreciated.