Livin404
Well-known Member
- Joined
- Jan 7, 2019
- Messages
- 743
- Office Version
- 365
- 2019
- Platform
- Windows
Good evening, I have a macro for a UserForm where data is placed into a data entry form which is then placed into a database which is fed into my Pivot Table. It works great except for one small part. It will not allow me to simply use my refresh command button, because it thinks I am skipping or leaving blank a required block. I need the code tweaked so it will not apply if only the refresh command is used. Sometimes I need my tables refreshed without necessarily putting data in.
The code below is what I'm using to make sure the block is not skipped. Yet when I select refresh it thinks I'm leaving the date block empty. Any suggestions? I want to keep my refresh command button on the UserForm. I'm trying to keep the user activity limited to just one worksheet.
Thank you,
The code below is what I'm using to make sure the block is not skipped. Yet when I select refresh it thinks I'm leaving the date block empty. Any suggestions? I want to keep my refresh command button on the UserForm. I'm trying to keep the user activity limited to just one worksheet.
VBA Code:
Private Sub TxtDate_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Trim(TxtDate.Value) = "" And Me.Visible Then
MsgBox "Please enter date in dd mmm yy format.", vbCritical, "Error"
Cancel = True
InboundForm.TxtDate.SetFocus
TxtDate.BackColor = vbYellow
Else
TxtDate.BackColor = vbWhite
End If
End Sub
Thank you,