Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Phil
You can use the Len(str) code. If your cell is A1 on sheet1 then Sub Macro1() Dim cellLength as Integer cellLength = Len(Sheets("Sheet1").Range("A1")) Msgbox(cellLength) End sub You can do the same thing with strings. For example, you have a string MyString and you want to know how long it is, you can use MyStringLength = Len(MyString). Dave "Phil Hageman" wrote: Is there a macro that will count the number of characters and spaces in a cell, or merged cell range? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dave,
Thanks for your reply. Is there a modification to the code where the macro acts on what ever cell in whatever worksheet where the cell is current? I placed this macro in Personal.xls Thanks, Phil "drhalter" wrote: Phil You can use the Len(str) code. If your cell is A1 on sheet1 then Sub Macro1() Dim cellLength as Integer cellLength = Len(Sheets("Sheet1").Range("A1")) Msgbox(cellLength) End sub You can do the same thing with strings. For example, you have a string MyString and you want to know how long it is, you can use MyStringLength = Len(MyString). Dave "Phil Hageman" wrote: Is there a macro that will count the number of characters and spaces in a cell, or merged cell range? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
cellLength = Len(ActiveCell)
"Phil Hageman" wrote: Dave, Thanks for your reply. Is there a modification to the code where the macro acts on what ever cell in whatever worksheet where the cell is current? I placed this macro in Personal.xls Thanks, Phil "drhalter" wrote: Phil You can use the Len(str) code. If your cell is A1 on sheet1 then Sub Macro1() Dim cellLength as Integer cellLength = Len(Sheets("Sheet1").Range("A1")) Msgbox(cellLength) End sub You can do the same thing with strings. For example, you have a string MyString and you want to know how long it is, you can use MyStringLength = Len(MyString). Dave "Phil Hageman" wrote: Is there a macro that will count the number of characters and spaces in a cell, or merged cell range? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Counting characters within a cell | Excel Worksheet Functions | |||
Counting characters in a cell | Excel Discussion (Misc queries) | |||
counting characters in a cell | Excel Discussion (Misc queries) | |||
Counting Characters in a cell | Excel Programming | |||
Counting Characters in a Cell | Excel Worksheet Functions |