Data Validation

  • Thread starter Thread starter muddan madhu
  • Start date Start date
M

muddan madhu

Hi,

I received excel file every date to work on..
more than 100 row and it depends .....
how do create data validation macro for only for 100 row or 200 rows.

Actually I have used macro recorder to put validation & it validates
to whole column.
I dont want to put validation for whole column , i need only upto the
value available in corresponding column.

Thanks in advance
 
Here is code from a recorded macro

With Selection.Validation
.Delete
.Add Type:=xlValidateWholeNumber, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="0", Formula2:="50"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With

Just change selectioion to the range your want

With Range("a5:D20").Validation
.Delete
.Add Type:=xlValidateWholeNumber, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="0", Formula2:="50"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
 
Back
Top