View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
merjet merjet is offline
external usenet poster
 
Posts: 812
Default Data validation question

Put the following in the Worksheet's code module:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$B$1" Then
If Range("A1") = 1 Then
With Range("B1").Validation
.Delete
.Add xlValidateList, xlValidAlertStop, xlBetween,
"=$C$1:$C$10"
.InCellDropdown = True
End With
End If
If Range("A1") = 2 Then
With Range("B1").Validation
.Delete
.Add xlValidateList, xlValidAlertStop, xlBetween,
"=$D$1:$D$10"
.InCellDropdown = True
End With
End If
End If
End Sub

HTH,
Merjet