How can I determine the length of data (all text) in a cell. I want to be able to do something when the length of text in a cell is more than 20 characaters.
Created a form with two text boxes, fed the one the cell value and the other the cell value trimmed to 20 characters and compared the two textbox values. Probably not the best way but it worked for me, this way I could also see how much too long it is.
if LEN(Textbox1.text)>20 then
msgbox "This cell has greater than 20 characters"
else
'whatever goes here
end if
However, you mentioned cells - you may simply use a worksheet formula to test....
=IF(LEN(A1)>20,"A1 has >20 characters","<20 characters")
Rgds, Geoff
We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.