cs0815
cs0815

Reputation: 17418

validation for all rows of a column in excel 2010

Creating, for example, a date validation for one rows of one cell in excel 2010 is no problem. Can I automatically apply this validation rule to all subsequent rows of that column when I create an excel sheet from this template?

Upvotes: 0

Views: 118

Answers (1)

Matt Cremeens
Matt Cremeens

Reputation: 5151

You can identify the last row of a column, like so

finalRow = cells(1000000,1).end(xlup).row

and then loop through the column to apply your validation to every cell in that column. So,

for i = 1 to finalRow
  'your validation code here which will refer to the ith row (e.g., cells(i,1))
  'column A = 1; column B = 2, and so on
next i

Hope that helps.

Upvotes: 1

Related Questions