Simple question?? Nested ifs on one line
You do not need two IF statements to accomplish the end product:
If OneH = YNewH Then
GoTo DisplayMsg
End If
The logic is that if OneH equals YNewH then it obviously is not equal to the
empty string.
But if you still want to check for the empty string, you can:
If OneH < "" And OneH = YNewH Then
GoTo DisplayMsg
End If
If you are asking whether the If statements can be nested, the answer is
yes, but I believe there is a limit of about 15 and each one must have an
End If. It might be easier to use the If...ElseIf...Else...End If format.
That format will handle many comparisons. See VBA help file for details.
Example:
If OneH < "" Then
'Do something or do nothing
ElseIf OneH = YNewH Then
GoTo DisplayMsg
Else
'Exit Sub maybe
End If
"laavista" wrote in message
...
I'm using Excel 2003.
This seems like it should be very simple, but I've tried lots of things,
and
nothing works.
I have a large amount of "checks" to do so I would like to put 2 if
statements on one line.
I'd like to put this on one line:
If OneH < "" then
If OneH = YNewH then
goto DisplayMsg
end if
end if
Your help would be GREATLY appreciated!
|