Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'd like to step through the characters in a string and parse out some data.
I want to do something like this For each Character in myString Next Character I get an error that I can only iterate over a collection object or array. What do I need to do so that I can do this? Thanks, Barb Reinhardt |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
A string isn't a collection, so you can't use For Each...Next
One way: Dim i As Long For i = 1 To Len(myString) Debug.Print Mid(myString, i, 1) Next i In article , Barb Reinhardt wrote: I'd like to step through the characters in a string and parse out some data. I want to do something like this For each Character in myString Next Character I get an error that I can only iterate over a collection object or array. What do I need to do so that I can do this? Thanks, Barb Reinhardt |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub StepThroughString()
Dim str As String, myString As String myString = "Test string" Dim i As Integer For i = 1 To Len(myString) str = Mid(myString, i, 1) Next i End Sub HTH, CoRrRan Barb Reinhardt wrote: I'd like to step through the characters in a string and parse out some data. I want to do something like this For each Character in myString Next Character I get an error that I can only iterate over a collection object or array. What do I need to do so that I can do this? Thanks, Barb Reinhardt |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'd like to step through the characters in a string and parse out
some data. I want to do something like this For each Character in myString Next Character I get an error that I can only iterate over a collection object or array. What do I need to do so that I can do this? Depending on what you mean by "parse out some data", there MAY be other ways to do what you want instead of doing a character by character search. Can you give us an example of a typical string you might want to parse and what in it you want to remove? Rick |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Counting one Character as a String | Excel Worksheet Functions | |||
Excel 2007 - Formatting text in cell (character by character) | Excel Discussion (Misc queries) | |||
Excel-Match 1st text character in a string to a known character? | Excel Worksheet Functions | |||
importing undelimited text file data, character-by-character | Excel Programming | |||
Function to return Character Position of Xth character within a string | Excel Programming |