email with condition
HI All,
I am working on a worksheet which has a range N11: N33 and has a Numeric Value, I want to send a email directly from EXCEL if any cell in this range gets the value 2. If there is more than 1 cell which has value more than 2, two different mail should go with a Text body, I am writing a code: 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("N11"), rng) Is Nothing Then If Range("N11").Value 2 Then Mail_with_Outlook2 '(Macro to send email) ElseIf Range("N12").Value 2 Then Mail_with_Outlook1 ' (Macro to send email2) ....... ....... If I use ElseIf, other condition do not get validated if the first condition is fulfilled any suggestions?? |
All times are GMT +1. The time now is 07:54 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com