Sunday, 16 November 2014

Adding data validation on list using VB

Sub DataValidation()

    Columns("A:A").Select ' Validation Applied
    With Selection.Validation
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=$B$1:$B$4" ' Validation Range                  
        .IgnoreBlank = True ' IF blank needs to be ignored. True or False
        .InCellDropdown = True
        .InputTitle = ""
        .ErrorTitle = "Application Error" ' Error Title
        .InputMessage = "Select Name" ' ALT text can be used as description about drop down
        .ErrorMessage = "Select the Correct Field" ' Error Message
        .ShowInput = True
        .ShowError = True
    End With


End Sub 


  1. Someone Sometimes with visits your blog regularly and recommended it in my experience to read as well. The way of writing is excellent and also the content is top-notch. Thanks for that insight you provide the readers!
    Email List Cleaning