Hello Experts,

Need your help in understanding why i am failing in the below VBA code

What i want results is if B15 is not empty and one of the cell in Range(C15:i15) is empty, give the error - code is working fine in the first if condition

If B15 is empty and one of the cell in C15:I15 is not empty, give the error - Not working

Kndly help me out on this.

Sub Macro4()

'Giving results what i want
If IsEmpty(Range("B15").Value) = False And IsEmpty(Range("C15").Value) = True Or IsEmpty(Range("D15").Value) = True Or IsEmpty(Range("E15").Value) = True Or IsEmpty(Range("F15").Value) = True Or IsEmpty(Range("G15").Value) = True Or IsEmpty(Range("H15").Value) = True Or IsEmpty(Range("I15").Value) = True Then

MsgBox ("Error")

Else
MsgBox ("No error")

End If

'Not giving results what i want

If IsEmpty(Range("C15").Value) = False Or IsEmpty(Range("D15").Value) = False Or IsEmpty(Range("E15").Value) = False Or IsEmpty(Range("F15").Value) = False Or IsEmpty(Range("G15").Value) = False Or IsEmpty(Range("H15").Value) = False Or IsEmpty(Range("I15").Value) = False And IsEmpty(Range("B15").Value) = True Then

MsgBox ("Error")

Else
MsgBox ("No error")

End If

End Sub