![]() |
Macro syntax to check string length in a cell
I'm trying to find the VB syntax for checking the length of a string in a
cell. Any takers? I'm stuck. |
Macro syntax to check string length in a cell
mystring = ActiveCell.Value
mylen = Len(mystring) MsgBox mylen Gord Dibben MS Excel MVP On Wed, 1 Nov 2006 12:16:02 -0800, 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. |
Macro syntax to check string length in a cell
Sub lcheck()
MsgBox (Len(Selection.Value)) End Sub Select a cell adn run the macro. -- Gary's Student "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. |
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 |
All times are GMT +1. The time now is 02:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com