ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Two IF Statements Q (https://www.excelbanter.com/excel-programming/414241-two-if-statements-q.html)

Sean

Two IF Statements Q
 
I have the following code (partial extract), which I am attempting to
add 2 IF statements, but the 2nd is not returning the required action

O169 = 0
BD1 = 98

Thus I expect the Importance to be set to High, if O169 or BD1 0,
otherwise set to normal

How would I incorporate that into code below? (Currently it is setting
importance to Normal)

Thanks

With OutMail
.To = ThisWorkbook.Sheets("Value").Range("AJ1").Value
.CC = strto
.BCC = ""
.Subject =
ThisWorkbook.Sheets("Values").Range("AJ4").Value
.Body = strbody
.Attachments.Add Destwb.FullName
.ReadReceiptRequested = False
If Sheets("Values").Range("O169").Value 0 Then
.Importance = 2
If Sheets("Values").Range("BD1").Value 0 Then
.Importance = 2
Else
.Importance = 1
End If
End If

Stefi

Two IF Statements Q
 
..Importance = IIf(Sheets("Values").Range("O169").Value 2 Or
Sheets("Values").Range("BD1").Value 0, 2, 1)

Regards,
Stefi

€žSean€ť ezt Ă*rta:

I have the following code (partial extract), which I am attempting to
add 2 IF statements, but the 2nd is not returning the required action

O169 = 0
BD1 = 98

Thus I expect the Importance to be set to High, if O169 or BD1 0,
otherwise set to normal

How would I incorporate that into code below? (Currently it is setting
importance to Normal)

Thanks

With OutMail
.To = ThisWorkbook.Sheets("Value").Range("AJ1").Value
.CC = strto
.BCC = ""
.Subject =
ThisWorkbook.Sheets("Values").Range("AJ4").Value
.Body = strbody
.Attachments.Add Destwb.FullName
.ReadReceiptRequested = False
If Sheets("Values").Range("O169").Value 0 Then
.Importance = 2
If Sheets("Values").Range("BD1").Value 0 Then
.Importance = 2
Else
.Importance = 1
End If
End If


Sean

Two IF Statements Q
 
Thanks Stefi, works like a dream


Stefi

Two IF Statements Q
 
You are welcome! Thanks for the feedback!
Stefi

€žSean€ť ezt Ă*rta:

Thanks Stefi, works like a dream




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com