Data validation with the Select Case statement

  • Thread starter Thread starter acw
  • Start date Start date
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
 
Back
Top