IF statement error

ddub25

Well-known Member
Joined
Jan 11, 2007
Messages
617
Office Version
  1. 2019
Platform
  1. Windows
Sub Ent1()
Dim IsItFS As String
Dim P1NS As String
Dim P1WG As String
Dim GS As String

IsItFS = Range("CH73").Text
P1NS = Range("CI73").Text
P1WG = Range("CJ73").Text
GS = Range("CK73").Text

If IsItFS = "1stSet" And P1NoS = "NoSe" And P1Ga = "W" Then
MsgBox ("Pass")
Else
MsgBox ("Fail")
End If
End Sub

This code is outputting "Fail" in the message box when it should output "Pass" as the 3 IF's asked are true. Have I got the syntax wrong on the IF and AND part of this code?
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Rich (BB code):
Sub Ent1()

	Dim IsItFS As String, P1NS As String, P1WG As String, GS As String

	IsItFS = Range("CH73").Value
	P1NS = Range("CI73").Value
	P1WG = Range("CJ73").Value
	GS = Range("CK73").Value

	If IsItFS = "1stSet" And P1NS = "NoSe" And P1WG = "W" Then
		MsgBox "Pass"
	Else
		MsgBox "Fail"
	End If

End Sub

edit: also, please use code tags when posting code. thanks :)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,780
Messages
6,121,525
Members
449,037
Latest member
tmmotairi

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