+ Reply to Thread
Results 1 to 5 of 5

number input box

  1. #1
    Stan Halls
    Guest

    number input box

    i am trying to creat a input box that i can type a number in and when i close
    the box that number will be transferd into a cell on the spreadsheet, also i
    need to check that the number entered is between to 1 - 6 ,
    Any ideas


  2. #2
    Bob Phillips
    Guest

    Re: number input box

    Dim ans

    Do
    ans = Application.InputBox("input a number between 1 and 6)",
    Type:=2)
    If ans <> False Then
    If ans < 1 Or ans > 6 Then
    MsgBox "Invalid amount"
    End If
    End If
    Loop Until ans = False Or (ans >= 1 And ans <= 6)
    If ans <> False Then
    Worksheets("Sheet1").Range("H10").Value = ans
    End If


    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Stan Halls" <StanHalls@discussions.microsoft.com> wrote in message
    news:36DB8C67-03CF-4480-8C15-53BE5A64C1B5@microsoft.com...
    > i am trying to creat a input box that i can type a number in and when i

    close
    > the box that number will be transferd into a cell on the spreadsheet, also

    i
    > need to check that the number entered is between to 1 - 6 ,
    > Any ideas
    >




  3. #3
    Toppers
    Guest

    RE: number input box

    Stan,
    Look at Data==>Validation==> select "Whole number" from Allow:
    dropdown. You can set range to 1 to 6.


    HTH

    "Stan Halls" wrote:

    > i am trying to creat a input box that i can type a number in and when i close
    > the box that number will be transferd into a cell on the spreadsheet, also i
    > need to check that the number entered is between to 1 - 6 ,
    > Any ideas
    >


  4. #4
    Stan Halls
    Guest

    Re: number input box

    Perfect, thank you very much for that

    "Bob Phillips" wrote:

    > Dim ans
    >
    > Do
    > ans = Application.InputBox("input a number between 1 and 6)",
    > Type:=2)
    > If ans <> False Then
    > If ans < 1 Or ans > 6 Then
    > MsgBox "Invalid amount"
    > End If
    > End If
    > Loop Until ans = False Or (ans >= 1 And ans <= 6)
    > If ans <> False Then
    > Worksheets("Sheet1").Range("H10").Value = ans
    > End If
    >
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (replace somewhere in email address with gmail if mailing direct)
    >
    > "Stan Halls" <StanHalls@discussions.microsoft.com> wrote in message
    > news:36DB8C67-03CF-4480-8C15-53BE5A64C1B5@microsoft.com...
    > > i am trying to creat a input box that i can type a number in and when i

    > close
    > > the box that number will be transferd into a cell on the spreadsheet, also

    > i
    > > need to check that the number entered is between to 1 - 6 ,
    > > Any ideas
    > >

    >
    >
    >


  5. #5
    Bob Phillips
    Guest

    Re: number input box

    Toppers answer is better!

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Stan Halls" <StanHalls@discussions.microsoft.com> wrote in message
    news:7A733FD4-3C4A-4EB7-81EB-7D25421623E4@microsoft.com...
    > Perfect, thank you very much for that
    >
    > "Bob Phillips" wrote:
    >
    > > Dim ans
    > >
    > > Do
    > > ans = Application.InputBox("input a number between 1 and 6)",
    > > Type:=2)
    > > If ans <> False Then
    > > If ans < 1 Or ans > 6 Then
    > > MsgBox "Invalid amount"
    > > End If
    > > End If
    > > Loop Until ans = False Or (ans >= 1 And ans <= 6)
    > > If ans <> False Then
    > > Worksheets("Sheet1").Range("H10").Value = ans
    > > End If
    > >
    > >
    > > --
    > > HTH
    > >
    > > Bob Phillips
    > >
    > > (replace somewhere in email address with gmail if mailing direct)
    > >
    > > "Stan Halls" <StanHalls@discussions.microsoft.com> wrote in message
    > > news:36DB8C67-03CF-4480-8C15-53BE5A64C1B5@microsoft.com...
    > > > i am trying to creat a input box that i can type a number in and when

    i
    > > close
    > > > the box that number will be transferd into a cell on the spreadsheet,

    also
    > > i
    > > > need to check that the number entered is between to 1 - 6 ,
    > > > Any ideas
    > > >

    > >
    > >
    > >




+ 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