Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Counting Cell Characters

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Counting Cell Characters

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Counting Cell Characters

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting characters within a cell Alco Engineer Excel Worksheet Functions 5 November 4th 08 06:08 PM
Counting characters in a cell Laura Henderson Excel Discussion (Misc queries) 5 September 16th 08 06:41 PM
counting characters in a cell Ram Excel Discussion (Misc queries) 3 July 29th 06 05:04 PM
Counting Characters in a cell Jordan Excel Programming 1 March 5th 05 06:11 PM
Counting Characters in a Cell carl Excel Worksheet Functions 2 February 4th 05 04:00 PM


All times are GMT +1. The time now is 05:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"