ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   change event not recognized (https://www.excelbanter.com/excel-programming/365433-change-event-not-recognized.html)

rebelxtuser

change event not recognized
 
I am running Excel 2003 under Windows XP, and I want to do some data
validation when a cell is changed in the worksheet. Using this example from
Visual Basic Help:

Private Sub Worksheet_Change(ByVal Target as Range)
Target.Font.ColorIndex = 5
End Sub

this Sub is never executed when any cell in the worksheet is changed. I
set a breakpoint in the sub, and it never triggered. Does the sub have to be
in some particular module, or do events have to be activated in some manner?

Bob Phillips

change event not recognized
 
Did you put it in the sheet code module, not a standard code module?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"rebelxtuser" wrote in message
...
I am running Excel 2003 under Windows XP, and I want to do some data
validation when a cell is changed in the worksheet. Using this example

from
Visual Basic Help:

Private Sub Worksheet_Change(ByVal Target as Range)
Target.Font.ColorIndex = 5
End Sub

this Sub is never executed when any cell in the worksheet is changed. I
set a breakpoint in the sub, and it never triggered. Does the sub have to

be
in some particular module, or do events have to be activated in some

manner?



Nick Hodge

change event not recognized
 
The procedure must be in the worksheet module who events you are monitoring.
Right click the sheet tab and select 'view code'. It goes here

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"rebelxtuser" wrote in message
...
I am running Excel 2003 under Windows XP, and I want to do some data
validation when a cell is changed in the worksheet. Using this example
from
Visual Basic Help:

Private Sub Worksheet_Change(ByVal Target as Range)
Target.Font.ColorIndex = 5
End Sub

this Sub is never executed when any cell in the worksheet is changed. I
set a breakpoint in the sub, and it never triggered. Does the sub have to
be
in some particular module, or do events have to be activated in some
manner?




Jim Thomlinson

change event not recognized
 
if your events have been disabled without being re-enabled then you will have
to re-enable them. Run this one litle bit of code and then try your
spreadsheet again

Sub ResetEvents()
application.enableevents = true
end sub

Whenever you are toggling application settings make sure that you reset them
and that you have error handling to catch the inevitable error that will come
up at some point in your life...
--
HTH...

Jim Thomlinson


"rebelxtuser" wrote:

I am running Excel 2003 under Windows XP, and I want to do some data
validation when a cell is changed in the worksheet. Using this example from
Visual Basic Help:

Private Sub Worksheet_Change(ByVal Target as Range)
Target.Font.ColorIndex = 5
End Sub

this Sub is never executed when any cell in the worksheet is changed. I
set a breakpoint in the sub, and it never triggered. Does the sub have to be
in some particular module, or do events have to be activated in some manner?



All times are GMT +1. The time now is 08:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com