+ Reply to Thread
Results 1 to 4 of 4

InStr

  1. #1
    FGM
    Guest

    InStr

    Excel Microsoft XP on Windows 200

    I am using a form as a utility for a group of macros and one of the text
    filelds on form asks for the column and row to start the searh in ex. b2

    I want to be able to check with vb that the user put both a numeric key and
    a alpha key, better yet I would like to check that it is a valid address.

    Any suggestions...

    Thank you in advance....

  2. #2
    Bernie Deitrick
    Guest

    Re: InStr

    FGM,

    For example:

    Dim myRange As Range
    On Error GoTo Badstring:
    Set myRange = Range(UserForm1.TextBox1.Text)
    MsgBox "Good string"
    Exit Sub
    Badstring:
    MsgBox "That was bad."

    HTH,
    Bernie
    MS Excel MVP


    "FGM" <[email protected]> wrote in message
    news:[email protected]...
    > Excel Microsoft XP on Windows 200
    >
    > I am using a form as a utility for a group of macros and one of the text
    > filelds on form asks for the column and row to start the searh in ex. b2
    >
    > I want to be able to check with vb that the user put both a numeric key and
    > a alpha key, better yet I would like to check that it is a valid address.
    >
    > Any suggestions...
    >
    > Thank you in advance....




  3. #3
    Bob Phillips
    Guest

    Re: InStr

    Just check it really is a range

    Private Sub CommandButton1_Click()
    Dim rng As Range
    On Error Resume Next
    Set rng = Range(TextBox1.Value)
    On Error GoTo 0
    If rng Is Nothing Then
    MsgBox "Input a valid range (A1, B1,AB99 etc.)"
    With TextBox1
    .SelStart = 0
    .SelLength = Len(.Text)
    .SetFocus
    End With
    End If
    End Sub


    or use a RefEdit control.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "FGM" <[email protected]> wrote in message
    news:[email protected]...
    > Excel Microsoft XP on Windows 200
    >
    > I am using a form as a utility for a group of macros and one of the text
    > filelds on form asks for the column and row to start the searh in ex.

    b2
    >
    > I want to be able to check with vb that the user put both a numeric key

    and
    > a alpha key, better yet I would like to check that it is a valid address.
    >
    > Any suggestions...
    >
    > Thank you in advance....




  4. #4
    FGM
    Guest

    Re: InStr

    thank you... you guys are great..

    "Bob Phillips" wrote:

    > Just check it really is a range
    >
    > Private Sub CommandButton1_Click()
    > Dim rng As Range
    > On Error Resume Next
    > Set rng = Range(TextBox1.Value)
    > On Error GoTo 0
    > If rng Is Nothing Then
    > MsgBox "Input a valid range (A1, B1,AB99 etc.)"
    > With TextBox1
    > .SelStart = 0
    > .SelLength = Len(.Text)
    > .SetFocus
    > End With
    > End If
    > End Sub
    >
    >
    > or use a RefEdit control.
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "FGM" <[email protected]> wrote in message
    > news:[email protected]...
    > > Excel Microsoft XP on Windows 200
    > >
    > > I am using a form as a utility for a group of macros and one of the text
    > > filelds on form asks for the column and row to start the searh in ex.

    > b2
    > >
    > > I want to be able to check with vb that the user put both a numeric key

    > and
    > > a alpha key, better yet I would like to check that it is a valid address.
    > >
    > > Any suggestions...
    > >
    > > Thank you in advance....

    >
    >
    >


+ Reply to Thread

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