D
Dana DeLouis
I suppose you could combine them if you wanted into one function based on
what you are doing....
Option Explicit
Dim Re As RegExp
Function Letters_Numbers(s As String) As Variant
' = = = = = = = = = = = = = = = = = = = = = = = = =
'// Dana DeLouis
'// Microsoft VBScript Regular Expressions 5.5
'// Return {Letters, Numbers}
' = = = = = = = = = = = = = = = = = = = = = = = = =
Dim v As Variant 'Hold temp variable
If Re Is Nothing Then
Set Re = New RegExp
Re.IgnoreCase = True
Re.Global = True
End If
Re.Pattern = "\d" 'Remove Digits
v = Re.Replace(s, vbNullString)
Re.Pattern = "\D" 'Remove Letters
Letters_Numbers = Array(v, Re.Replace(s, vbNullString))
End Function
Sub TestIt()
[A1] = "AS154WEP7548WE"
[B1:C1] = Letters_Numbers([A1].Value)
End Sub
--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =
<snip>
what you are doing....
Option Explicit
Dim Re As RegExp
Function Letters_Numbers(s As String) As Variant
' = = = = = = = = = = = = = = = = = = = = = = = = =
'// Dana DeLouis
'// Microsoft VBScript Regular Expressions 5.5
'// Return {Letters, Numbers}
' = = = = = = = = = = = = = = = = = = = = = = = = =
Dim v As Variant 'Hold temp variable
If Re Is Nothing Then
Set Re = New RegExp
Re.IgnoreCase = True
Re.Global = True
End If
Re.Pattern = "\d" 'Remove Digits
v = Re.Replace(s, vbNullString)
Re.Pattern = "\D" 'Remove Letters
Letters_Numbers = Array(v, Re.Replace(s, vbNullString))
End Function
Sub TestIt()
[A1] = "AS154WEP7548WE"
[B1:C1] = Letters_Numbers([A1].Value)
End Sub
--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =
<snip>