JackDanIce
Well-known Member
- Joined
- Feb 3, 2010
- Messages
- 9,922
- Office Version
- 365
- Platform
- Windows
Hi,
I have the following code which is giving a run-time error message, though was working fine earlier.
Formula1 (List_Status)is a named range which hasn't changed location,address or values. The range value when error occurs is found in List_Status
Line of error (red), rng.address is A19 and rng.parent.name is name of the activesheet this occurs on
Searching online seems to generally suggest using .Validation.Delete prior to validation.add but I already have this line so unclear as cause of error. Excel 2013
Any ideas?
Thanks in advance,
Jack
I have the following code which is giving a run-time error message, though was working fine earlier.
Formula1 (List_Status)is a named range which hasn't changed location,address or values. The range value when error occurs is found in List_Status
Line of error (red), rng.address is A19 and rng.parent.name is name of the activesheet this occurs on
Rich (BB code):
Public Sub Add_Validation(ByRef rng as Range)
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
With rng
If Len(.Value) > 0 Then
.Validation.Delete
.Validation.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=List_Status"
End If
End With
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
Any ideas?
Thanks in advance,
Jack
Last edited: