Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Bonni Garcia   on Nov 10 In MS Office Category.

  
Question Answered By: Rudy Turner   on Nov 10

using your code one can create a function that will pull out any
block of consecutive numeric or alphabetic characters. The first
limitation I've found however is that the code requires the string input
to begin with numeric data.



___________________________________________________________



Function CharStrings(ByVal cell  As String, group As Double)



Dim Strng As String, aChr As String

Dim i As Integer, idx As Integer

Dim str(10) As String



Strng = cell



For i = 1 To 10: str(i) = "": Next i

idx = 0



For i = 1 To Len(Strng)

aChr = Mid(Strng, i, 1) ' find the character

If InStr("0123456789", aChr) > 0 Then ' is it numeric

If Int(idx / 2) * 2 = idx Then idx = idx + 1

Else

If Int(idx / 2) * 2 <> idx Then idx = idx + 1

End If

str(idx) = str(idx) & aChr

Next i



CharStrings = str(group)



End Function

Share: 

 

This Question has 11 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on loop through a range name Or get search suggestion and latest updates.


Tagged: