Stuck on IF statement

srosk

Board Regular
Joined
Sep 17, 2018
Messages
132
I'm having trouble with the following code. Hopefully someone is able to help.

Code:
If Sheets("Instructions").Range("D20").Value = "Yes" And Range("E" & r).Value = 6 And Range("AK" & r).Value = 1 Then
        VestingReport2Import_4Message 3, False, r, "_", "_", "Test Message"

If Instruction D20 = Yes and the value in column in E = 6 and AK = 1, then it should put "Test Message". The program works when And Range("AK" & r).Value = "1" is commented out.

Is there any way for the additional criteria to be added? Currently, it is as if all of column AK <> 1, because nobody received the test message.

Thank you!
 
Last edited:

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Rounding error ? What makes you think "AK & r" is 1 ?
Put the cursor in each cell that you think is 1 in AK and have a close look at the value just above columns D and E (on the right of the"fx"), that will tell you the true cell value. It might say 1 in the cell but it may be a different value above.
 
Upvote 0
Rounding error ? What makes you think "AK & r" is 1 ?
Put the cursor in each cell that you think is 1 in AK and have a close look at the value just above columns D and E (on the right of the"fx"), that will tell you the true cell value. It might say 1 in the cell but it may be a different value above.

Hey there thanks for the reply. Earlier in my program it is set to define AK to equal a 1 or 0 using an IF and Vlookup statement. I then copy paste value to AK, and then run VestingReport2Import_4Message
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top