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

Limiting values in Excel 1

Status
Not open for further replies.

slurpee55

Technical User
Dec 17, 2004
20
0
0
US
Hi all,

I have a nice little seating chart setup running in Excel (thanks Andy!). There are up to 157 seats that could be sold each night, and one person may buy up to 8 seats.
My main problem remaining is that the seats are named A1-A11, B1-B18, C1-C18...H1-H18 and I1-I20. Unfortunately, I can enter an incorrect seat number, e.g. A200. How can I make it so that only the correct seats may be entered? I don't want to use a drop down list, but do have a list of the correct seat numbers in a column on the sheet.
The current code, which prevents selling duplicate seats is:

Private Sub Worksheet_Change(ByVal Target As Range)
If Selection.Cells.Count > 1 Then Exit Sub
If WorksheetFunction.CountIf(Range("Ag5:An161"), Target) > 1 Then
MsgBox "Already sold."
Target = ""
End If
End Sub

Thanks in advance!

 
Have you used data validation? under settings you can link the available data to your list and you can check or uncheck the in-cell dropdown

Paul D
[pimp] pimpin' aint easy
 
Sheesh, thanks - never tried validating from a list without using it as a drop-down listing...works great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top