+ Reply to Thread
Results 1 to 4 of 4

Inputbox with VBA

  1. #1
    Jeff
    Guest

    Inputbox with VBA

    Hello,

    I have this procedure:
    iMatch = Application.Match(908, Range("A:A"), 0)
    I need help to include an Inputbox that would prompt the user to enter "908".
    The inputbox msg should read " Customer number"
    --
    Regards,
    Jeff


  2. #2
    Bob Phillips
    Guest

    Re: Inputbox with VBA

    Dim ans
    Dim fValid As Boolean

    fValid = False
    Do
    ans = InputBox("Input Customer Number")
    If ans = "" Then
    Exit Sub
    Else
    If IsNumeric(ans) Then
    If ans > 0 Then
    fValid = True
    iMatch = Application.Match(ans, Range("A:A"), 0)
    'more code
    End If
    End If
    End If
    Loop Until fValid

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "Jeff" <[email protected]> wrote in message
    news:[email protected]...
    > Hello,
    >
    > I have this procedure:
    > iMatch = Application.Match(908, Range("A:A"), 0)
    > I need help to include an Inputbox that would prompt the user to enter

    "908".
    > The inputbox msg should read " Customer number"
    > --
    > Regards,
    > Jeff
    >




  3. #3
    Dave Peterson
    Guest

    Re: Inputbox with VBA

    dim CustNumber as long
    dim iMatch as variant
    custNumber = application.inputbox(prompt:="Customer Number",type:=1)
    if custnumber = 0 then
    exit sub
    end if

    imatch = Application.Match(custnumber, Range("A:A"), 0)
    if iserror(imatch) then
    'not found
    else
    'found
    end if

    application.inputbox with type:=1 forces the user to enter numbers.


    Jeff wrote:
    >
    > Hello,
    >
    > I have this procedure:
    > iMatch = Application.Match(908, Range("A:A"), 0)
    > I need help to include an Inputbox that would prompt the user to enter "908".
    > The inputbox msg should read " Customer number"
    > --
    > Regards,
    > Jeff


    --

    Dave Peterson

  4. #4
    Dave Peterson
    Guest

    Re: Inputbox with VBA

    I think this:
    iMatch = Application.Match(ans, Range("A:A"), 0)
    needs to be:
    iMatch = Application.Match(clng(ans), Range("A:A"), 0)
    if that table is really numbers.


    Bob Phillips wrote:
    >
    > Dim ans
    > Dim fValid As Boolean
    >
    > fValid = False
    > Do
    > ans = InputBox("Input Customer Number")
    > If ans = "" Then
    > Exit Sub
    > Else
    > If IsNumeric(ans) Then
    > If ans > 0 Then
    > fValid = True
    > iMatch = Application.Match(ans, Range("A:A"), 0)
    > 'more code
    > End If
    > End If
    > End If
    > Loop Until fValid
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (remove nothere from email address if mailing direct)
    >
    > "Jeff" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hello,
    > >
    > > I have this procedure:
    > > iMatch = Application.Match(908, Range("A:A"), 0)
    > > I need help to include an Inputbox that would prompt the user to enter

    > "908".
    > > The inputbox msg should read " Customer number"
    > > --
    > > Regards,
    > > Jeff
    > >


    --

    Dave Peterson

+ 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