View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
kounoike[_2_] kounoike[_2_] is offline
external usenet poster
 
Posts: 126
Default Using Split Function on String with no spaces

What about making a short function like this

Sub test()
Dim str As String
Dim a
str = "DF345"
a = exnum(str)
MsgBox a(1) & " : " & a(0)
End Sub

Function exnum(ByVal s As String) As Variant
Dim arr()
ReDim arr(1)
arr(0) = StrReverse(Val(StrReverse(s)))
arr(1) = Replace(s, arr(0), "")
If arr(1) = "" Then
ReDim Preserve arr(0)
End If
exnum = arr
End Function

keizi

"ExcelMonkey" wrote in message
...
I have a cell address - assume its relative - "DF456". I want to split this
up by colunm address and row address "DF" and "456". I was hoping I could
use the Split funciton But I am not sure what delimiter to use if I am going
to use the Split function - if its even applicable.

Or am I forced to loop through the string find the starting/ending points of
Letters/Numbers and use the replace function to redefine (i.e.
replace("DF456","DF", "") = "456" and replace("DF456","456", "") = "DF"

Thanks

EM