View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Macro syntax to check string length in a cell

if len(worksheets("sheet1").range("a1").value) 3 then
or
if len(worksheets("sheet1").range("a1").text) 3 then

..text is what you see in the cell. .value is what the cell actually contains.

===
If you put 3 in a cell, the .value is 3.

But if you format it to show $3.00, then .text is $3.00



El Bee wrote:

I'm trying to find the VB syntax for checking the length of a string in a
cell.
Any takers? I'm stuck.


--

Dave Peterson