0

I've to execute a piece of code written in Visual Basic for Applications (VBA) when the excel cell is not empty. I've written below piece of code so far:

Public Sub BindTitles(ByVal cell As Range)
    If IsEmpty(cell.Value) Then
        Application.EnableEvents = False
        'other code
    End If
End Sub

I want to invert the logical condition present in If statement. In C#, I use exclamation operator ! but when I put it in If block it gives below error:

Compile error:

Invalid or unqualified reference

RBT
  • 24,161
  • 21
  • 159
  • 240

1 Answers1

1

The logical negation ! operator in VBA is Not:

If Not IsEmpty(cell.Value) Then '...
RBT
  • 24,161
  • 21
  • 159
  • 240
Kostas K.
  • 8,293
  • 2
  • 22
  • 28