Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Message Box Improvements

This code counts the characters and spaces in a cell. Could the message box
be modified to also show the sum of characters and spaces, as well as a text
statement €śCharacters 255 will not paste€ť?

Sub CountCharacters()
Dim StringLength As Integer
Dim EmptySpaces As Integer
Dim I As Integer
Dim CellRef As Variant
CellRef = Trim(ActiveCell.Value)
StringLength = Len(ActiveCell.Value)
For I = 1 To Len(ActiveCell.Value)
If Mid(CellRef, I, 1) = " " Then EmptySpaces = EmptySpaces + 1
Next
MsgBox "Characters: " & StringLength & Chr(10) & "Empty Spaces: " &
EmptySpaces
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Message Box Improvements

Do you mean

MsgBox "Characters: " & StringLength & Chr(10) & _
"Empty Spaces: " & EmptySpaces & Chr(10) & _
"CharCharacters 255 will not paste"

--
HTH

Bob Phillips

"Phil Hageman" wrote in message
...
This code counts the characters and spaces in a cell. Could the message

box
be modified to also show the sum of characters and spaces, as well as a

text
statement "Characters 255 will not paste"?

Sub CountCharacters()
Dim StringLength As Integer
Dim EmptySpaces As Integer
Dim I As Integer
Dim CellRef As Variant
CellRef = Trim(ActiveCell.Value)
StringLength = Len(ActiveCell.Value)
For I = 1 To Len(ActiveCell.Value)
If Mid(CellRef, I, 1) = " " Then EmptySpaces = EmptySpaces + 1
Next
MsgBox "Characters: " & StringLength & Chr(10) & "Empty Spaces: " &
EmptySpaces
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Message Box Improvements

Hi Bob,

Getting closer. Need somehting like:

Characters 215
Spaces 22
Total 237

Text message is good.

Phil

"Bob Phillips" wrote:

Do you mean

MsgBox "Characters: " & StringLength & Chr(10) & _
"Empty Spaces: " & EmptySpaces & Chr(10) & _
"CharCharacters 255 will not paste"

--
HTH

Bob Phillips

"Phil Hageman" wrote in message
...
This code counts the characters and spaces in a cell. Could the message

box
be modified to also show the sum of characters and spaces, as well as a

text
statement "Characters 255 will not paste"?

Sub CountCharacters()
Dim StringLength As Integer
Dim EmptySpaces As Integer
Dim I As Integer
Dim CellRef As Variant
CellRef = Trim(ActiveCell.Value)
StringLength = Len(ActiveCell.Value)
For I = 1 To Len(ActiveCell.Value)
If Mid(CellRef, I, 1) = " " Then EmptySpaces = EmptySpaces + 1
Next
MsgBox "Characters: " & StringLength & Chr(10) & "Empty Spaces: " &
EmptySpaces
End Sub




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Message Box Improvements

MsgBox "Characters: " & StringLength & vbnewline & _
"Spaces: " & EmptySpaces & vbNewLine & _
"Total " & StringLength + EmptySpaces

--
HTH

Bob Phillips

"Phil Hageman" wrote in message
...
Hi Bob,

Getting closer. Need somehting like:

Characters 215
Spaces 22
Total 237

Text message is good.

Phil

"Bob Phillips" wrote:

Do you mean

MsgBox "Characters: " & StringLength & Chr(10) & _
"Empty Spaces: " & EmptySpaces & Chr(10) & _
"CharCharacters 255 will not paste"

--
HTH

Bob Phillips

"Phil Hageman" wrote in message
...
This code counts the characters and spaces in a cell. Could the

message
box
be modified to also show the sum of characters and spaces, as well as

a
text
statement "Characters 255 will not paste"?

Sub CountCharacters()
Dim StringLength As Integer
Dim EmptySpaces As Integer
Dim I As Integer
Dim CellRef As Variant
CellRef = Trim(ActiveCell.Value)
StringLength = Len(ActiveCell.Value)
For I = 1 To Len(ActiveCell.Value)
If Mid(CellRef, I, 1) = " " Then EmptySpaces = EmptySpaces + 1
Next
MsgBox "Characters: " & StringLength & Chr(10) & "Empty Spaces: " &
EmptySpaces
End Sub






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
Overview Improvements for Excel Worksheets Feda Excel Discussion (Misc queries) 5 September 18th 07 10:08 PM
Counting Consecutive Improvements SteveC Excel Discussion (Misc queries) 0 June 13th 06 01:35 AM
Improvements in Excel Pivot Table Access4Afghan Excel Discussion (Misc queries) 5 February 12th 06 02:41 PM
Improvements for text finding functions yarp Excel Discussion (Misc queries) 2 August 8th 05 04:01 PM
anyone have any improvements for my Weeks Function? reesmacleod[_6_] Excel Programming 8 December 5th 03 11:30 PM


All times are GMT +1. The time now is 08:13 AM.

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

About Us

"It's about Microsoft Excel"