Within VBA code, you would use similar function, but a few differences.
STR = VBA.Trim(STR)
This removes any leading/trailing spaces
VBA.Mid(STR, 4, 1)
This gets just the 4 character provided STR is at least 4 characters long
Combine that with a For...Next recursive statement, you can get the
following code:
Dim l_strSingleCharacter As String, l_lngNthCharacter As Long
For l_lngNthCharacter = 1 to VBA.Len(STR) Step 1
l_lngNthCharacter = VBA.Mid(STR,l_lngNthCharacter,1)
<Perform other statements>
Next l_lngNthCharacter
--
Thanks,
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
This formula - =RIGHT(TRIM(A5),LEN(TRIM(A5))-1) works. I tried to do
the same with vba code and I got stuck. What I would like to know is
there a way to address individual characters in a string. For
example, in C, if I had a string called STR. I could write out STR as
a string, or I could use an index and take each character such. Is
there anything in vba which would allow the same kind of access to
individual characters? If I wanted to find the 4th character in the
string "stringfinder", how would that be done in vba?
thanks,
Andy