Solved

Excel 2007 VBA to Check for listbox selection

Posted on 2013-01-14
2
382 Views
Last Modified: 2013-01-14
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.
0
Comment
Question by:usernameX
2 Comments
 
LVL 29

Accepted Solution

by:
gowflow earned 500 total points
ID: 38776088
is that what you want ?
make sure macroes are enabled and test this in Sheet1 for cells E2 and E3 it is VBA code.
gowflow
E2E3.xls
0
 
LVL 13

Expert Comment

by:Shanan212
ID: 38776189
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
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question