Generate a pop up message based on several conditions

Mitch3256

New Member
Joined
Aug 15, 2018
Messages
2
Hi, I am having trouble generating a message when multiple conditions meet, the code I am using is below. The data is coming in from PI process book and are all declared correctly.

If CV3033Run = "On" And FD3031Run = "STOP" And FDFD3032RUN = "STOP" And PC1SV < 400 And PC2WRB = "Off" And PC2ERB = "Off" And PC2WRomLev > 20 And PC2WLev > 20 And PC2ERomLev > 20 And PC2ELev > 20 And PC2Display = False Then


RoomtoMove = PC1SVTPH - PC1MIN
PC2MAX = PC2WMAX + PC2EMAX
PC2Current = PC2WSV + PC2ESV
PC2Availability = PC2MAX - PC2Current
PC2Display = True

End If

If PC2Display = True And RoomtoMove < PC2Availability Then
PC1By = PC1SV - RoomtoMove
ab = "Reduce PC1 MAX SP To "
MsgBox [ab] & [PC1By], vbCritical, "Reduce PC2 MAX SP"
PC2Display = False

ElseIf PC2Display = True And RoomtoMove > PC2Availability Then
PC2MAX = PC2WMAX + PC2EMAX
PC2Current = PC2WSV + PC2ESV
PC2Availability = PC2MAX - PC2Current
PC2By = PC1SV - PC2Availability
ac = "Reduce PC1 MAX SP To "
MsgBox [ac] & [PC2By], vbCritical, "Reduce PC1 MAX SP"
PC2Display = False
End If

Any help is much appreciated.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
What are you expecting to happen and is not?
Have you tried stepping through the code with [F8] to see the path the code is taking?
 
Upvote 0
What are you expecting to happen and is not?
Have you tried stepping through the code with [F8] to see the path the code is taking?

Wow I didn't know about that little feature, I will have a play it that and see If I can get it working. Cheers mate.
 
Upvote 0
While stepping thru the code, you can hover your mouse over the variables and it should display their value.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,189
Members
452,616
Latest member
intern444

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