B
Bradley C. Hammerstrom
E2K
This works for my test workbook, but I want it to work for any workbook I
open, new or existing. In other words the code needs to be attached to
Excel, not attached to a particular workbook or worksheet. But How?
Scenario:
A custom toolbar in Personal.xls (hidden) has two buttons assigned to two
macros. The macros are stored in a Module in Personal.xls. The idea is that
when a user adds data to an existing workbook, all new or edited cells are
in a red font. (I realize Track Changes does similar, but looses highlights
after re-opening the file.)
The two macros:
-----------------------------------------------
Sub TypeInRedOn()
MsgBox "Type all new or edited cell values in Red?" & Chr(13) _
"Note: This will continue until you turn it off.", vbYesNo, "Start
TypeInRed?"
Application.EnableEvents = True
End Sub
-----------------------------------------------
-----------------------------------------------
Sub TypeInRedOff()
MsgBox ("Stop changing the font color?"), vbYesNo, "Stop TypeInRed?"
Application.EnableEvents = False
End Sub
------------------------------------------------
The EnableEvents method refers to a procedure stored in Sheet1:
------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Target.Font.ColorIndex = 3
End Sub
How can I make this WorksheetEvent application-wide, rather than specific to
a single sheet?
Brad H.
This works for my test workbook, but I want it to work for any workbook I
open, new or existing. In other words the code needs to be attached to
Excel, not attached to a particular workbook or worksheet. But How?
Scenario:
A custom toolbar in Personal.xls (hidden) has two buttons assigned to two
macros. The macros are stored in a Module in Personal.xls. The idea is that
when a user adds data to an existing workbook, all new or edited cells are
in a red font. (I realize Track Changes does similar, but looses highlights
after re-opening the file.)
The two macros:
-----------------------------------------------
Sub TypeInRedOn()
MsgBox "Type all new or edited cell values in Red?" & Chr(13) _
"Note: This will continue until you turn it off.", vbYesNo, "Start
TypeInRed?"
Application.EnableEvents = True
End Sub
-----------------------------------------------
-----------------------------------------------
Sub TypeInRedOff()
MsgBox ("Stop changing the font color?"), vbYesNo, "Stop TypeInRed?"
Application.EnableEvents = False
End Sub
------------------------------------------------
The EnableEvents method refers to a procedure stored in Sheet1:
------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Target.Font.ColorIndex = 3
End Sub
How can I make this WorksheetEvent application-wide, rather than specific to
a single sheet?
Brad H.