for each character in a cell

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

I need to perform a function for each character in a cell.

I have for each c in activecell.characters
do something
next c

I get "Object does not support this property or method"

Any advice?

Thanks,
Kevin
 
Hi,
From the XL online documentation on CHaracters:
"Remarks
The Characters object isn't a collection
"
That is, For Each won't work. You have to loop with a regular For:

Dim i as long, ttl as long
Dim s as string
ttl=ActiveCell.Characters.Count
For i=1 to ttl
s= ActiveCell.Characters(i,1).text
NExt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top