View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default ITERATING A SINGLE CELL!

Hi
try

sub foo()
dim svalue
dim i as integer

svalue=activesheet.range("A1").value
for i = 1 to len(svalue)
msgbox mid(svalue,i,1)
next
end sub

--
Regards
Frank Kabel
Frankfurt, Germany

jay dean wrote:
Hi-
I wanted the vba code to iterate through one cell. Yes, the len
formula works for counting the elements in a cell (**as an example**),
but what if I wanted to say loop through one single cell to add to or
replace or remove some of its characters?
I just need to know how to programmatically iterate through the
characters in a cell (if it is at all possible). Thanks.

Emmanuel


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!