I am new to VBA. I am having a VBA excel macro coding(Excel Validation Drop Down list using VBA) in a old project. When the drop-down going to a maximum number of list I am getting the error.The drop down data are collected from another sheet
Below is the screenshot
Public Sub CORE_SetValidation(ByRef Rng As Range, ByVal Value As String)
With Rng.Validation
Call .Delete
If Value <> "" Then
Call .Add(Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Formula1:=Value)
.ErrorMessage = "Please select a value from drop-down list"
.ErrorTitle = "Value Error"
.IgnoreBlank = True
.InCellDropdown = True
.InputMessage = ""
.InputTitle = ""
.ShowInput = True
.ShowError = True
End If
End With
End Sub
- Is there any limit for characters or drop-down list in VBA drop-down, Because from the error message I am unable to predict the issue.
- Can I able to get the exact error message.
Call
is deprecated and unnecessary. Just use.Delete
and.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Formula1:=Value
– ThunderFrame