Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / October 2008

Tip: Looking for answers? Try searching our database.

Macro to run when cell changes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
newguy - 09 Oct 2008 17:32 GMT
I am trying to get this code to work that when the cell value changes
it calls another macro that sends and email but I can't get it to send
the email. The other macro on it own works.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$AE$1573" Then
Mail_small_Text_Outlook
End If
End Sub
Jon Peltier - 09 Oct 2008 17:44 GMT
1. Is the Worksheet_Change procedure in the module corresponding to the
sheet with the changing cell?

2. This is a better way to test the target:

   If Not Intersect(Target, Range("$AE$1573")) Is Nothing Then

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______

>I am trying to get this code to work that when the cell value changes
> it calls another macro that sends and email but I can't get it to send
[quoted text clipped - 5 lines]
> End If
> End Sub
newguy - 09 Oct 2008 17:54 GMT
Yes the procedure is in the module with the changing cell.

On Oct 9, 12:44 pm, "Jon Peltier" <jonxlmv...@SPAMpeltiertech.com>
wrote:
> 1. Is the Worksheet_Change procedure in the module corresponding to the
> sheet with the changing cell?
[quoted text clipped - 19 lines]
> > End If
> > End Sub
newguy - 09 Oct 2008 18:14 GMT
That didn't work either
Mike - 09 Oct 2008 17:48 GMT
module1.Mail_small_Text_Outlook

> I am trying to get this code to work that when the cell value changes
> it calls another macro that sends and email but I can't get it to send
[quoted text clipped - 5 lines]
>  End If
> End Sub
Gord Dibben - 09 Oct 2008 22:19 GMT
You haven't changed anything so your event won't fire.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$AE$1573" <> "" Then
Mail_small_Text_Outlook
End If
End Sub

Gord Dibben  MS Excel MVP

>I am trying to get this code to work that when the cell value changes
>it calls another macro that sends and email but I can't get it to send
[quoted text clipped - 5 lines]
> End If
>End Sub
newguy - 10 Oct 2008 13:07 GMT
So how do I get it to recognize the change. The cell I am referencing
is a sum and when the sum changes I want to send and email. The code
above gives my a "type mismatch" error.

Thanks
Jon Peltier - 10 Oct 2008 13:48 GMT
If a formula recalculates, it does not count as a "change", because the
formula itself is unchanged. You need to look at changes in the precedents
of the formula. You could simply fire your code off the Worksheet_Calculate
event, but it's more involved to limit it to changes in the calculated value
of a given cell. You have to save the old value of the cell, compare it to
the current value, and do your stuff if the values differ.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______

> So how do I get it to recognize the change. The cell I am referencing
> is a sum and when the sum changes I want to send and email. The code
> above gives my a "type mismatch" error.
>
> Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.