Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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. -- Fred |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA code behind command button | Excel Worksheet Functions | |||
Starting/Stopping Worksheet Event Code | Excel Discussion (Misc queries) | |||
Where?Worksheet code module or Worksheet_SelectionChange event han | Excel Worksheet Functions | |||
Command Button VBA code | Excel Discussion (Misc queries) | |||
Worksheet Event Code | Excel Worksheet Functions |