Results 1 to 12 of 12

Search & Replace InString

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Search & Replace InString

    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
    Last edited by bdb1974; 05-04-2010 at 09:24 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1