Link to home
Start Free TrialLog in
Avatar of usernameX
usernameX

asked on

Excel 2007 VBA to Check for listbox selection

I have a data validation list in cell E2.  I want to prevent data entry in cell E3 if a selection has not been made in E2.   Thus display an error message an lock E3

If a selection is made in E2 than I want to let a data value be entered in cell E3.  Thus no message and unlock E3.

I need these actions to occur when focus is on cell E3.
ASKER CERTIFIED SOLUTION
Avatar of Jacques Geday
Jacques Geday
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can do this without VBA

Enter this as data validation formula on E3

=LEN(E2)>0

Also uncheck choose  'ignore blank' and enter error message as I entered.

This wouldnt let any entries on E3 as long as E2 is blank (or length of E2 value is zero)

See book attached
Book1.xlsx