ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range.Validation Questions (https://www.excelbanter.com/excel-programming/313168-range-validation-questions.html)

Ben Crinion

Range.Validation Questions
 
Hi

I have an applicaton that takes a selection of cells which should be a list
of numbers.

I use the SpecialCells function to ensure that i have a range which consists
of only numbers and no text strings.

I also want to ensure that all the strings are of a minimum length. I know
there is a range validation method and a textLength option that goes with it
but im not sure if it will do what i want it to. I cant find much info on
how to use it other than the 1 example on MSDN.

Anyone got any clues?

Thanks

BC



JulieD

Range.Validation Questions
 
Hi Ben

one option, you could cycle through the range you've selected checking the
length in each cell and writing the "non-compliant" cells to a message box
e.g.

Dim strmsg

strmsg = "Non Compliant cells"
For Each cell In myrange 'use the range you've already selected
If Len(cell.Value) < 10 Then 'or whatever length you're after
strmsg = strmsg & "; " & cell.Address
End If
Next
MsgBox strmsg

Hope this helps
Cheers
JulieD

"Ben Crinion" wrote in message
...
Hi

I have an applicaton that takes a selection of cells which should be a
list of numbers.

I use the SpecialCells function to ensure that i have a range which
consists of only numbers and no text strings.

I also want to ensure that all the strings are of a minimum length. I know
there is a range validation method and a textLength option that goes with
it but im not sure if it will do what i want it to. I cant find much info
on how to use it other than the 1 example on MSDN.

Anyone got any clues?

Thanks

BC





All times are GMT +1. The time now is 08:34 AM.

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