Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restricting Cell Input Contingent on ComboBox Selection

Status
Not open for further replies.

palmese

Technical User
Dec 11, 2002
15
0
0
US
I have an Excel Employee Expense template where the user makes selections from a number of ComboBoxes.

The problem I am having is that I need to limit the user to not be able to type in amounts in cells (i.e. B12:B30) unless they have chosen a selection in the ComboBox. An example would be a ComboBox (sitting on top of Cell B11) in which the user makes a selection and THEN AND ONLY THEN the user would have the capability of typing in expenses amounts (in Cells B12:B30).

Right now, the Forms look great but we just received an expense report where the user made no selections in the ComboBoxes but nonetheless had the capability of entering in expense amounts. This is causing trouble because in order for the AP accountants to charge the expense amounts -they need to know what to charge to (which is based on the unselected ComboBoxes).

I hope I have been clear in explaining my problem. Any help would be appreciated.
 
I'm not an Excel expert, but you could probably catch the Selection_Change event on the worksheet and change the selected cell to the one containing the combobox if they haven't made a selection there yet.
 
Palmese ...
What about locking the cells that you do not want the User to be able to change, then in Selection_change or one of the combobox events, unlock the appropriate cells. Just remember to relock them in code!
If I remember locked is a simple boolean property of the cell object. There are several methods where you could toggle a global level variable boolean property with the combobox events and lock/unlock all, a few or only one cell with a Sub or even a macro.
Michael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top