G Guest Nov 1, 2006 #1 I'm trying to find the VB syntax for checking the length of a string in a cell. Any takers? I'm stuck.
I'm trying to find the VB syntax for checking the length of a string in a cell. Any takers? I'm stuck.
G Gord Dibben Nov 1, 2006 #2 mystring = ActiveCell.Value mylen = Len(mystring) MsgBox mylen Gord Dibben MS Excel MVP
G Guest Nov 1, 2006 #3 Sub lcheck() MsgBox (Len(Selection.Value)) End Sub Select a cell adn run the macro.
D Dave Peterson Nov 1, 2006 #4 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
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