Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default E-Mail generation when cell value equals x

Hi All,

I have the following code from Ron db most excellent website. It generates
an e-mail when the value in one cell equals 1. What I would like is for this
to work in a range of cells.

The spreadsheet is used as a sickness log which has, amoungst others, 3
columns, due date, E-Mail, Actual Date (G12, H12 and I12 respectively). When
a due date appears in G12 the value of H12 changes from 0 to 1 and an e-mail
is generated with the code below. But when the user completes an actual date
the next due date (G13) is generated and the value of H12 changes back to 0
and the value of H13 changes from 0 to 1. It is this that I am using to
trigger the e-mail but as you can see from the code below it is only looking
at one cell H12.

How can I get this macro to work on all cells H12 to H67?

I hope I have explained myself clearly!

Thanks

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("H12"), rng) Is Nothing Then

If Range("H12").Value = 1 Then EMailReminder

End If
End If
EndMacro:
End Sub




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default E-Mail generation when cell value equals x

You need to update the following line

If Not Intersect(Range("H12"), rng) Is Nothing Then

to cover the range you want to monitor. So if you wanted to check
H12:H100, it would read

If Not Intersect(Range("H12:H100"), rng) Is Nothing Then

--JP


On Oct 15, 12:14*pm, BaggieDan
wrote:
Hi All,

I have the following code from Ron db most excellent website. *It generates
an e-mail when the value in one cell equals 1. *What I would like is for this
to work in a range of cells.

The spreadsheet is used as a sickness log which has, amoungst others, 3
columns, due date, E-Mail, Actual Date (G12, H12 and I12 respectively). *When
a due date appears in G12 the value of H12 changes from 0 to 1 and an e-mail
is generated with the code below. *But when the user completes an actual date
the next due date (G13) is generated and the value of H12 changes back to 0
and the value of H13 changes from 0 to 1. *It is this that I am using to
trigger the e-mail but as you can see from the code below it is only looking
at one cell H12.

How can I get this macro to work on all cells H12 to H67?

I hope I have explained myself clearly!

Thanks

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("H12"), rng) Is Nothing Then

* * * * * * If Range("H12").Value = 1 Then EMailReminder

End If
End If
EndMacro:
End Sub


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
If a cell equals _, at the next row that equals _, return value fr CathyH Excel Worksheet Functions 10 May 2nd 07 07:53 PM
If cell is left blank, or equals zero, then cell equals a different cell John McMurry Excel Discussion (Misc queries) 3 April 13th 07 01:14 PM
How to create/run "cell A equals Cell B put Cell C info in Cell D abmb161 Excel Discussion (Misc queries) 5 January 26th 06 06:36 PM
if a:a (range) equals january and c:c equals gas then add g:g ($) BCOz Excel Worksheet Functions 4 December 29th 05 07:40 PM
custom filter does not work when selecting 'equals' X AND 'equals' plindman Excel Discussion (Misc queries) 1 June 1st 05 11:29 PM


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