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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Validation in Combo Boxes - Excel 2

Status
Not open for further replies.

bluebilly

Technical User
Nov 11, 2002
48
AU
I have 2 Combo boxes in a workbook - one containing a list of numbers from 1 to 31 and the other containing the month of the year. I want to stop users selecting, the 30th & 31st of Feb and 31st of Apr, Jun, Sep & Nov (for obvious reasons) - which I guess can be done using data validation.
Can someone plesae assist me ?
I've tried using this formula ( k21 & i21 are the month & day cell links), but I want the message box to pop up as the user enters a 'rogue' day which doesn't appear to happen, unless you select the cell that the formula is in and put it into edit !
The formula I have tried is thus :
=if(k21=2, i21<=29, if(k21=4, i21<=30, if(k21=6, i21<=30, if(k21=9, i21<=30, if(k21=11, i21<=30))))
where 2=Feb, 4=Apr, 6=Jun, 9=Sep & 11=Nov

Please be aware I am a complete novice where VB us concerned so tread lightly if you can help.
Many thanks for at least reading this thread.

Bill

 
It is not the direct answer to your question, but can easy your problem. The idea is: use calendar instead of drop-down list.
You have not mentioned what kind of combo boxes you use (toolbox, forms, data validation), so will start from thebeginning.

1. Right-click menubar or any toolbar and display toolbox toolbar.
2. On the toolbox select additional controls and find Calendar Control. Click it and drag the shape somewhere on the sheet. Adjust its size if necessary.
3. Do not close the toolbox yet. Note that VB design mode is on (marked design button on the bar, icon with triangle). This allows you to manipulate objects admissible via toolbox.
4. Right-click the calendar and select &quot;properties&quot; from the popup menu. You should see a list of calendar's properties. Find LinkedCell property and write appropriate address (for example A1).
5. Select (Custom) property, click ... and adjust calendar's appearence.
6. Close properties window, click &quot;exit design mode&quot; on the toolbox and close the toolbox.

If you need to make future changes, display toolbox again (1) and click &quot;Design mode&quot; button.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top