Sweedler
Board Regular
- Joined
- Nov 13, 2020
- Messages
- 114
- Office Version
- 2016
- Platform
- Windows
- MacOS
Hi
So I have a Userform I am using to fill in data on a sheet. I have put in place extra Macros to keep me from leaving any spaces blank (see below):
Private Sub listedbox_Exit(ByVal cancel As MSForms.ReturnBoolean)
If Trim(listedbox.Value) = "" And Me.Visible Then
MsgBox "Listed or Unlisted"
cancel = True
investmentnew.listedbox.SetFocus
listedbox.BackColor = vbYellow
Else
listedbox.BackColor = vbWhite
End If
End Sub
The problem comes when I try to exit/cancel the user form. These safeguards don't let me exit the userform as there are still blanks.
Any suggestions for how I can skip these Macros when clicking cancel or a way to go around somehow. I have tried everything I can think of.
So I have a Userform I am using to fill in data on a sheet. I have put in place extra Macros to keep me from leaving any spaces blank (see below):
Private Sub listedbox_Exit(ByVal cancel As MSForms.ReturnBoolean)
If Trim(listedbox.Value) = "" And Me.Visible Then
MsgBox "Listed or Unlisted"
cancel = True
investmentnew.listedbox.SetFocus
listedbox.BackColor = vbYellow
Else
listedbox.BackColor = vbWhite
End If
End Sub
The problem comes when I try to exit/cancel the user form. These safeguards don't let me exit the userform as there are still blanks.
Any suggestions for how I can skip these Macros when clicking cancel or a way to go around somehow. I have tried everything I can think of.