Data validation with the Select Case statement

A

acw

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top