Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default Simple Change Event not working

I have a simple change event in Sheet1. Why is this not firing when I type a
number greater than 100 in A1

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target 100 Then
MessageBox ("Changed Value")
End If
End Sub

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,311
Default Simple Change Event not working

This works for me.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target 100 Then
MsgBox ("Changed Value")
End If
End Sub


"ExcelMonkey" wrote in message
...
I have a simple change event in Sheet1. Why is this not firing when I type
a
number greater than 100 in A1

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target 100 Then
MessageBox ("Changed Value")
End If
End Sub

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Simple Change Event not working

What does your custom function MessageBox do?

When you set a breakpoint in the function, does the event macro fire?

In article ,
ExcelMonkey wrote:

I have a simple change event in Sheet1. Why is this not firing when I type a
number greater than 100 in A1

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target 100 Then
MessageBox ("Changed Value")
End If
End Sub

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Simple Change Event not working

Change: MessageBox ("Changed Value")
To: MsgBox "Changed Value"

Merjet


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Simple Change Event not working

Besides the obvious error with MessageBox vice MsgBox, this version worked
for me:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target 100 Then
MsgBox ("Changed Value")
End If
End Sub

Perhaps you have disabled events.

--
Regards,
Tom Ogilvy


"ExcelMonkey" wrote:

I have a simple change event in Sheet1. Why is this not firing when I type a
number greater than 100 in A1

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target 100 Then
MessageBox ("Changed Value")
End If
End Sub

Thanks



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default Simple Change Event not working

It does not do anything. I just want proof that the macro is firing. And
its not firing. Even if I put a break in, it does not fire. I can't seem to
get any examples to work. Why would this be?

EM

"JE McGimpsey" wrote:

What does your custom function MessageBox do?

When you set a breakpoint in the function, does the event macro fire?

In article ,
ExcelMonkey wrote:

I have a simple change event in Sheet1. Why is this not firing when I type a
number greater than 100 in A1

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target 100 Then
MessageBox ("Changed Value")
End If
End Sub

Thanks


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,311
Default Simple Change Event not working

Tom Ogilvy mentioned that you may Events Disabled.

I'm sure there is another way to enable them, but here is one way.

Sub EnableEvents()
Application.EnableEvents = True
End Sub

Run manually.

Regards,
Paul


"ExcelMonkey" wrote in message
...
It does not do anything. I just want proof that the macro is firing. And
its not firing. Even if I put a break in, it does not fire. I can't seem
to
get any examples to work. Why would this be?

EM

"JE McGimpsey" wrote:

What does your custom function MessageBox do?

When you set a breakpoint in the function, does the event macro fire?

In article ,
ExcelMonkey wrote:

I have a simple change event in Sheet1. Why is this not firing when I
type a
number greater than 100 in A1

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target 100 Then
MessageBox ("Changed Value")
End If
End Sub

Thanks




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Simple Change Event not working

Couple of possibilities:

because you (or a workbook/add-in you've opened) have disabled events
with

Application.EnableEvents = False

or because the code is not in the correct worksheet module

or because macros are disabled...



In article ,
ExcelMonkey wrote:

It does not do anything. I just want proof that the macro is firing. And
its not firing. Even if I put a break in, it does not fire. I can't seem to
get any examples to work. Why would this be?

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default Simple Change Event not working

Yup events were not enabled. Not sure how this happened.

Thanks

EM

"JE McGimpsey" wrote:

What does your custom function MessageBox do?

When you set a breakpoint in the function, does the event macro fire?

In article ,
ExcelMonkey wrote:

I have a simple change event in Sheet1. Why is this not firing when I type a
number greater than 100 in A1

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target 100 Then
MessageBox ("Changed Value")
End If
End Sub

Thanks


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change Event not working on 1 machine jlclyde Excel Discussion (Misc queries) 2 January 20th 10 07:15 PM
Worksheet Change Event - not working in XP Eva Shanley[_2_] Excel Programming 3 September 21st 04 01:51 PM
Simple change event. Need guidance. Jakester Excel Programming 2 May 15th 04 12:43 AM
Need code for simple change event Jake[_8_] Excel Programming 2 May 14th 04 11:29 PM


All times are GMT +1. The time now is 04:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"