Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Data validation with the Select Case statement
Billabong
Try: Private Sub CommandButton1_Click() Select Case Cells(5, "F") '= "istext()" Case "trillium" Cells(2, "B") = "trillium" Cells(3, "B") = "456 maple rd." Case "brooks" Cells(2, "B") = "Brooks ltd" Cells(3, "B") = "123 maple rd." Case "peterson" Cells(2, "B") = "peterson ltd" Cells(3, "B") = "789 maple rd." Case Else Cells(2, "B") = "" Cells(3, "B") = "" End Select End Sub If you want to make sure there is something in F5 before you start, then perform the test and only move onto the Select statement if it is valid. eg If WorksheetFunction.IsText(Cells(5, "F")) Then ... Tony -----Original Message----- Hello Iam trying to use a drop down list created by data validation to generate an address. The user selects the name then presses command buton to make address appear. When I run the program below it does not select the correct address with respect to the name of company in drop down list. For example if I select Brooks in drop down list it displays trilliums address Can anyone figure this out- TIA Private Sub CommandButton1_Click() Select Case Cells(5, "F") = "istext()" Case Cells(5, "F") = "trillium" Cells(2, "B") = "trillium" Cells(3, "B") = "456 maple rd." Case Cells(5, "F") = "brooks" Cells(2, "B") = "Brooks ltd" Cells(3, "B") = "123 maple rd." Case Else Cells(5, "F") = "peterson" Cells(2, "B") = "peterson ltd" End Select End Sub . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I get a Data validation list to select another validation l | New Users to Excel | |||
Select Case Statement | Excel Worksheet Functions | |||
Case without Select Case error problem | Excel Discussion (Misc queries) | |||
case sensetive data validation | Excel Worksheet Functions | |||
import external data sql case statement | Excel Discussion (Misc queries) |