Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Running a macro based on cell value that is updated by formula

Hello can someone help me with this?
When I use the VBA code below, the macro will run when I update the
contents in the cell that feeds into G28's formula manually, however
the cell that feeds into "G28" a formula, and wont be keyed in
manually, so I want the macro to run when "G28" is updated
automatically due to its
formula and not due to manual entry. Any ideas?

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
If Target.Cells.Count 1 Then Exit Sub
On Error GoTo EndMacro
If Not Target.HasFormula Then
Set rng = Target.Dependents
If Not Intersect(Range("G28"), rng) Is Nothing Then
If Range("G28").Value = "Yes" Then Call
CDO_Mail_Small_Text
End If
End If
EndMacro:
End Sub


I got the code from the examples at this web site http://www.rondebruin.nl/mail/change.htm
and it says that this example is supposed to work if the cell
contents
is a formula but I cant get it to work.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Running a macro based on cell value that is updated by formula

That code will have a problem if any of the dependant of the formula in G28
are not on this sheet. Target.Dependents only returns the dependent cells on
the current sheet. Just one possible reason things might not be working...
--
HTH...

Jim Thomlinson


"GTVT06" wrote:

Hello can someone help me with this?
When I use the VBA code below, the macro will run when I update the
contents in the cell that feeds into G28's formula manually, however
the cell that feeds into "G28" a formula, and wont be keyed in
manually, so I want the macro to run when "G28" is updated
automatically due to its
formula and not due to manual entry. Any ideas?

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
If Target.Cells.Count 1 Then Exit Sub
On Error GoTo EndMacro
If Not Target.HasFormula Then
Set rng = Target.Dependents
If Not Intersect(Range("G28"), rng) Is Nothing Then
If Range("G28").Value = "Yes" Then Call
CDO_Mail_Small_Text
End If
End If
EndMacro:
End Sub


I got the code from the examples at this web site http://www.rondebruin.nl/mail/change.htm
and it says that this example is supposed to work if the cell
contents
is a formula but I cant get it to work.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Running a macro based on cell value that is updated by formula


See another response in your identical post in the public.excel group.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"GTVT06"
wrote in message Hello can someone help me with this?
When I use the VBA code below, the macro will run when I update the
contents in the cell that feeds into G28's formula manually, however
the cell that feeds into "G28" a formula, and wont be keyed in
manually, so I want the macro to run when "G28" is updated
automatically due to its
formula and not due to manual entry. Any ideas?

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
If Target.Cells.Count 1 Then Exit Sub
On Error GoTo EndMacro
If Not Target.HasFormula Then
Set rng = Target.Dependents
If Not Intersect(Range("G28"), rng) Is Nothing Then
If Range("G28").Value = "Yes" Then Call
CDO_Mail_Small_Text
End If
End If
EndMacro:
End Sub


I got the code from the examples at this web site http://www.rondebruin.nl/mail/change.htm
and it says that this example is supposed to work if the cell
contents
is a formula but I cant get it to work.

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
Running A Macro when data is updated. joecrabtree Excel Programming 1 December 4th 06 09:47 AM
Running a macro based on a value Jeanne Conroy Excel Programming 3 March 15th 06 10:19 PM
Macro not running when cell value is updated Jon[_21_] Excel Programming 1 November 5th 05 06:22 AM
Cell Value Updated based cell input DC Excel Discussion (Misc queries) 2 August 17th 05 11:07 PM
Running Event Procedure When Cell Updated on Excel Worksheet Tom Ogilvy Excel Programming 0 August 19th 04 03:38 PM


All times are GMT +1. The time now is 10:24 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"