Splitting IF statement in multiple lines in VBScript

Yes you can break IF statement in multiple lines in vbscript. Here is a very basic example

If 1 = 1 Or _
2 = 2 Then

wscript.echo "See, It Works :)"

End If

or

If (UCase(Trim("1")) = "1") Or _
(UCase(Trim("2")) = "2") Then

wscript.echo "See, It Works :)"

End If

The error is somewhere else. Check your workbook objects and their values. Also check the values of i, a and b.


Yes, line breaks in if statements are supported.

I ran the following code both in Excel/VBA and as a single vbscript and it worked without throwing an error.

Dim aStr
aStr = "yeah"

If (UCase(Trim(aStr)) = "YES") Or _
   (UCase(Trim(aStr)) = "NO") Then
  MsgBox "yes/no"
Else
  MsgBox "no action"
End If

Or is it a problem with objSheet? Did you try to set a variable for UCase(Trim(objSheet.Cells(i, a).Value)? Did it show the expected Value?