Range.Validation Questions

  • Thread starter Thread starter Ben Crinion
  • Start date Start date
B

Ben Crinion

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top