Verifying more than one txtbox has entries

tigerdel

Board Regular
Joined
Oct 13, 2015
Messages
145
Office Version
  1. 365
Platform
  1. Windows
Hi Guys

I need to ensure that if a combobox has a specific entry, a further txtbox also needs an entry

The code I have used for single entries is working fine but I can't get the dual entry to work

The codes I use are as below:

For the single entry

Code:
If cmbStatus.Value = "" Then
    MsgBox "You must add a Document Status", vbCritical
    Exit Sub

For the dual entry [which won't work] I used:

Code:
If cmbStatus.Value = "Approved" & txtApprover.Value = "" Then
    MsgBox "You must enter the name of the Approver", vbCritical
    Exit Sub

Any help gratefully received

Many thanks for looking

Derek
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi,
replace the ampersand & with And - see it this change resolves your issue

Rich (BB code):
If cmbStatus.Value = "Approved" And txtApprover.Value = "" Then
    MsgBox "You must enter the name of the Approver", vbCritical
    Exit Sub

Dave
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,432
Messages
6,124,860
Members
449,194
Latest member
HellScout

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top