View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] b.v.pelt@gmail.com is offline
external usenet poster
 
Posts: 1
Default Data validation dependent of value of option button

Hi,

I'm creating a form in Excel in which I want to validate data in a
specific cell dependant of value of an option button elsewhere on the
form. I,ve created code below, but despite the fact I'm not getting any
VB errors there is no validation either, respectless of what value I
put into subject cell or option button.

Can somebody point me in the right direction here? Thx!

Private Sub Worksheet_Change(ByVal target As Range)
If target = "B16" Then
If OptionButton1.Value = -1 Then
With target.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween, Formula1:="V6504:V7031"
.IgnoreBlank = True
.InCellDropdown = False
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = "Niet goed. Nog een keer proberen"
.ShowInput = True
.ShowError = True
End With
End If
End If
End Sub