Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Worksheet_change event assistance

Please help me out!

I have this piece of code:

Public Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("M7")) Is Nothing Then
FillOutReport
End If
End Sub

I want to change it so that FillOutReport also is called when the M7 is
cleared - meaning any change in the cell should call FillOutReport.

Anyone able to solve this?

Thanks
The Doctor
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Worksheet_change event assistance

It looks fine to me. Namely, if M7 has just changed the Intersect will
return a range hence passing the If test.

Is the Change event code in the correct sheet module and are events enabled.

Regards,
Peter T

"Dr. Schwartz" wrote in message
...
Please help me out!

I have this piece of code:

Public Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("M7")) Is Nothing Then
FillOutReport
End If
End Sub

I want to change it so that FillOutReport also is called when the M7 is
cleared - meaning any change in the cell should call FillOutReport.

Anyone able to solve this?

Thanks
The Doctor



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Worksheet_change event assistance

I tried your code in XL2003, and FillOutReport was triggered by clearing M7.
What is the problem?
Regards,
Stefi


€žDr. Schwartz€ť ezt Ă*rta:

Please help me out!

I have this piece of code:

Public Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("M7")) Is Nothing Then
FillOutReport
End If
End Sub

I want to change it so that FillOutReport also is called when the M7 is
cleared - meaning any change in the cell should call FillOutReport.

Anyone able to solve this?

Thanks
The Doctor

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Worksheet_change event assistance


It also works for me. However, a note...
it doesn't make the call if cell M7 is deleted (right-click and choose delete).
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Worksheet_change event assistance

The event code should be triggered by either setting M7 or clearing M7. I
would look very carefully at FillOutReport and any other macros to insure
they are not causing Application.EnableEvents to become false. This would
cause your symptoms. Also as a general preventative measure, use:

Application.EnableEvents=FLASE
Call FillOutReport
Application.EnableEvents=TRUE

If your condition does not improve, update the post.
--
Gary''s Student - gsnu200769


"Dr. Schwartz" wrote:

Please help me out!

I have this piece of code:

Public Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("M7")) Is Nothing Then
FillOutReport
End If
End Sub

I want to change it so that FillOutReport also is called when the M7 is
cleared - meaning any change in the cell should call FillOutReport.

Anyone able to solve this?

Thanks
The Doctor



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Worksheet_change event assistance

How very strange! I tried it out once more (in addition to the several 100 i
did before I wrote this post) and now it works...

Sorry to bother you all and thank you for spending time on this.

To Garys student: enabling and disabling the event while running a sub is
very useful and saves time. However this could not have caused the problem as
I was not aware of this functionality.

Thanks again
The Doctor

"Gary''s Student" wrote:

The event code should be triggered by either setting M7 or clearing M7. I
would look very carefully at FillOutReport and any other macros to insure
they are not causing Application.EnableEvents to become false. This would
cause your symptoms. Also as a general preventative measure, use:

Application.EnableEvents=FLASE
Call FillOutReport
Application.EnableEvents=TRUE

If your condition does not improve, update the post.
--
Gary''s Student - gsnu200769


"Dr. Schwartz" wrote:

Please help me out!

I have this piece of code:

Public Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("M7")) Is Nothing Then
FillOutReport
End If
End Sub

I want to change it so that FillOutReport also is called when the M7 is
cleared - meaning any change in the cell should call FillOutReport.

Anyone able to solve this?

Thanks
The Doctor

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
Worksheet_Change event Joanne Excel Programming 8 January 10th 08 08:42 AM
Worksheet_Change event Sandy Excel Programming 3 August 4th 07 12:23 PM
How do I change a Worksheet_change event to a beforesave event? Tueanker Excel Programming 5 June 29th 07 03:00 PM
Worksheet_change event Dwayne Smith Excel Programming 2 June 5th 04 03:25 AM
Worksheet_Change Event Sam Excel Programming 2 November 21st 03 06:51 PM


All times are GMT +1. The time now is 02:53 PM.

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

About Us

"It's about Microsoft Excel"