Not Operator in Excel VBA

By Hemanta Sundaray on 2021-09-10

The Not operator performs logical negation on a Boolean expression.

The following code snippets have been executed in the immediate window of the visual basic editor.

? Not False
True

? Not True
False

The following Sub procedure toggles the bold property of the Font object for the selected range.

Sub ToggleBold()

Selection.Font.Bold = Not Selection.Font.Bold

End Sub

Join the Newsletter