M. Babayev
M. Babayev

Reputation: 29

Disable form control button unless a condition met on sheet

I searched but all the answers were from 2009-2011 and they are not working the same way as Office 2019.

I have a form and a button which pops up a new Outlook page with attached copy of sheet which contains filled form. I have a cell which contains a formula to check if all fields have been filled and returns TRUE if they are.

I want that form control button to check if F28 cell is "TRUE" and stop working, run to an error or warning message, if it's not.

Upvotes: 0

Views: 456

Answers (1)

Chronocidal
Chronocidal

Reputation: 8081

I don't have a copy of Office 2019, but am going to assume that the current code is still valid in later version of VBA

If Not TargetRange.Value Then
    MsgBox "Please fill out ALL the fields"
    Exit Sub
End If

Upvotes: 1

Related Questions