| View previous topic :: View next topic |
| Author |
Message |
flash Newbie

Joined: 08 Dec 2005 Posts: 2
|
Posted: Thu Dec 08, 2005 9:58 am Post subject: How split a text |
|
|
I would like to 'split' a text and I don't how use correctly the split() function.
For example I have these data in the cell A1: (1:2)(3:4)
And I would like to get finally these values in four different cells : A2= 1, A3=2, A4=3 and A5=4
How can I get it?
Thanks for your help |
|
| Back to top |
|
 |
flash Newbie

Joined: 08 Dec 2005 Posts: 2
|
Posted: Thu Dec 08, 2005 10:34 am Post subject: |
|
|
After tests, I have this solution but maybe it exists a better one :
Sub Main
Dim sText as String
Dim round as Long
Dim character as String
Dim resu() as String
Dim x as Long
sText=InputBox("how do you want to split :")
For round=1 to 2
Select Case round
Case 1
character="("
Case 2
character=")"
End Select
resu=split(sText,character)
sText=join(resu(),":")
Next
resu=split(sText,":")
For x=LBound(resu) to UBound(resu)
If resu(x)<>"" Then
Print x, resu(x)
End if
Next
End Sub |
|
| Back to top |
|
 |
|