Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata
Public Function AlphaBreakdown(str As String) As String
 With CreateObject("vbscript.regexp")
  .Pattern = "[^\D]+"
  .Global = True
  AlphaBreakdown = Trim(.Replace(str, vbNullString))
  Debug.Print "Alpha = " & AlphaBreakdown
 End With
End Function
Public Function NumericBreakdown(str As String) As Double
 With CreateObject("vbscript.regexp")
  .Pattern = "[^\d]+"
  .Global = True
  NumericBreakdown = Trim(.Replace(str, vbNullString))
  Debug.Print "Numeric = " & NumericBreakdown
 End With
End Function
Public Sub AlphaNumericTest()

 Dim AlphaNumericStr As String
 AlphaNumericStr = "A100"

 Dim SeqStartNum As Double, SeqStartAlpha As String
 SeqStartNum = NumericBreakdown(AlphaNumericStr)
 SeqStartAlpha = AlphaBreakdown(AlphaNumericStr)
 Debug.Print "Seq Alpha = " & SeqStartAlpha
 Debug.Print "Seq Num = " & SeqStartNum

End Sub
  • No labels