Hi all,
I'm having somewhat of a difficult time trying to put some code together to
search for a string of characters matching a specific arrangement.
The specific arrange would be any numerical value followed by an alpha character.
such as: (1abc,12abc,123abc, 1234abc, 1234nabc....) n= any numeral of any length
abc = any alpha string of any length.
I'd would like to start the search from the LEFT(1abc,1), and for the only the
first case found,
the a space " " needs to be put between the numeric and alpha characters.
such as: (1 abc,12 abc,123 abc, 1234 abc, 1234 nabc....)
I don't know if these would be easier using a "case select" code
or something like
Private Sub CommandButton2_Click()
'For a text box imput
Dim testLChar as string
'Dim testMChar as string
Dim testMChar1 as string
Dim testMChar2 as string
Dim N As Integer
With Me.Txt_LOCATION
N = 1
testLChar = Left(.Value, N)
testMChar1 = Mid(.Value, N)
Do Until (testMChar1 Like "[0-9|A-Z]") = (testMChar2 Like "[A-Z_]")
If (testLChar Like "[0-9-A-Z]") Then
testMChar2 = Mid(.Value, N)
N = N + 1
If (testMChar2 Like "[A-Z]") Then
testMChar2 = " " & testMChar2
End If
End If
Loop
End With
end sub
...above code not working.
Any help is appreciated.
Thanks,
BDB
Bookmarks