Solved

Excel 2007 VBA to Check for listbox selection

Posted on 2013-01-14
2
380 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

772 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