PDA

View Full Version : Function for validating a column name and length of entries



lucpian
02-06-2008, 03:23 PM
Hi All,

I need help with writing a function that will validate a column A, and length of entries which must not be more or less than 5.

I am new to vba, and I am still grabbing with it.

Thanks

Lucpian

gwkenny
02-06-2008, 04:02 PM
Do not use VBA.

Highlight the cells you want to have validated for data entry. Then from the menu choose: Data/Validation. Criteria being Text Length and enter the appropriate restrictions.

If the data already exists, and you want to find out if any of the entries do not have a length of 5 then use Column B. In cell B2 use the formula: =if(Len(a2)<>5,1,0)

Copy this formula down for all the data in column A. Sort on Column B and you have all the data in Column A that does not meet your criteria in one place.

If you must have this in VBA, what do you want the computer to do when it comes across an entry that does not meet your criteria of text length of 5?

lucpian
02-07-2008, 07:42 AM
Thanks, but I am required to use VBA Code in this project to enable an automated process. So, if anyone can help me, please, I would be very grateful.

Lucpian