WATCH WINDOW

  • Thread starter Thread starter osmanchaudhry
  • Start date Start date
O

osmanchaudhry

Hi guys

does anyone know how to get a count of the number of characters in a
cell from the VBA watch window, what do i type?

Im sure this is is such as easy question but Ive exhausted every
possibility of "count, character, excel, VBA" etc in google and I cant
seem to find it!

Many thanks
Oz
 
I add debug statement into my code like countchar = Range("A5").count. Then
add countchar into the watch window.
 
Joel,

Range("A5").count will always return 1

I think you meant to say

countchar = len(Range("A5").value)

or
Countchar = range("A5").Characters.count

for the Original Poster
there is no property of a range that returns the count of the characters in
the range. You can use Range("A5").Characters.count possibly. (I never
use the watch window, so I can't say whether that is accessible or not).
 
Osman,

Have you tried the 'Len' function which returns the number of characters
in a string?

Regards

Michael Beckinsale







-----Original Message-----
From: (e-mail address removed) [mailto:o[email protected]]

Posted At: 26 February 2007 14:31
Posted To: microsoft.public.excel.programming
Conversation: WATCH WINDOW
Subject: WATCH WINDOW

Hi guys

does anyone know how to get a count of the number of characters in a
cell from the VBA watch window, what do i type?

Im sure this is is such as easy question but Ive exhausted every
possibility of "count, character, excel, VBA" etc in google and I cant
seem to find it!

Many thanks
Oz
 
In the Watch window, create a new watch of the expression Len(R.Value) where
R is a cell reference variable. This will update as you go from one cell to
the other.

If you just want the number of characters, you can do that from the
Immediate window:

?Len(R.Value)
' or
?Len(Range("A1").Value)

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)
 
Back
Top