MID Function - retrieve STRINGS & NUMBERS

  • This program allows the user to retrieve the Numbers and Text from the defined word
  •  

    Functions and Operators Used to derive the Output:

  • IsNumeric
  • Not Operator
  • Mid Function
  •  

    Private Sub CommandButton1_Click()
    Dim i As Integer
    r = 1
    Do Until Range("A" & r).Value = ""
    j = Range("A" & r).Value
    For i = 1 To Len(j)
    If IsNumeric(Mid(j, i, 1)) Then
    numb = numb & Mid(j, i, 1)
    Cells(r, 2) = numb
    ElseIf Not IsNumeric(Mid(j, i, 1)) Then
    stri = stri & Mid(j, i, 1)
    Cells(r, 3) = stri
    End If
    Next
    r = r + 1
    numb = 0
    stri = ""
    Loop
    End Sub

     

    Download The Workbook