ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Data Validation (https://www.excelbanter.com/excel-discussion-misc-queries/182670-data-validation.html)

muddan madhu

Data Validation
 
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

joel

Data Validation
 
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

"muddan madhu" wrote:

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



All times are GMT +1. The time now is 02:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com