+ Reply to Thread
Results 1 to 9 of 9

Fast Single Digit Entering

Hybrid View

  1. #1
    Registered User
    Join Date
    06-05-2009
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    50

    Fast Single Digit Entering

    Hi Forum Friends
    This is a sample macro to illustrate my problem.
    I would like the macro to work such that:
    1. I get 1 second to enter a single digit.
    2 the macro then uses the entered digit else it uses the default of 3
    WITHOUT stopping and prompting me for input i.e. without Appication.Inputbox, entering a value and OK .
    Many thanks
    Al

    Sub multibeepX()
        'Sample Code
        Dim my_beep As Integer
        my_beep = 3
        Application.Wait (Now + TimeValue("0:00:01"))
        my_beep = Application.InputBox(" Enter number of beeps: ", Default:=Format(my_beep), Type:=1)
        
        For I = 1 To my_beep
            Beep
        Next I
    End Sub

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Fast Single Digit Entering

    You can get input from a userform or inputbox, in this case the inputbox would be easiest.

    The only alternative wold be to use a cell & probably worksheet change event
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    06-05-2009
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    50

    Re: Fast Single Digit Entering

    Hi royUK
    Changing a cell would work. However, the macro does not
    allow me to change a cell while it is running or in wait state.
    From what I understand a worksheet change event does the
    opposite of what I need, starts a macro when a cell changes
    vs. changing a cell while a macro is running.
    Inputbox would work, but would require me to confirm OK for every
    time the macro loops through 52 set of calculations. The macro takes
    about 25 minutes to run. (I have a HP, Quad core, with 8 GB RAM)
    Thank you for your time.
    Regards
    Al
    Last edited by aljanga; 12-15-2009 at 09:57 PM. Reason: 10 minutes run time was incorrect

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Fast Single Digit Entering

    You could use a modeless userform with a textbox, use the textbox change event to capture single-keystroke data entries and clear the input, plus an on-time event to enter data if the user is idle.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    06-05-2009
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    50

    Re: Fast Single Digit Entering

    Hi Shg
    What you describe sounds like the
    solution I need.
    Unfortunately my knowledge of VBA is far too
    limited to write the code required.
    Al Jager

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Fast Single Digit Entering

    I don't have access to Excel for the next few days, sorry.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Fast Single Digit Entering

    An example workbook might help

  8. #8
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Fast Single Digit Entering

    Here is something you can use

    Make a Userform with 1 textbox

    Private Sub TextBox1_Change()
      Static x As Long
      x = x + 1
      TextBox1 = Left(TextBox1, 1)
      TextBox1.SelStart = 0
      TextBox1.SelLength = 1
      Cells(x, "A").Value = TextBox1.Text
    End Sub
    Private Sub UserForm_Initialize()
      TextBox1.SetFocus
      TextBox1.EnterFieldBehavior = fmEnterFieldBehaviorSelectAll
    End Sub
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  9. #9
    Registered User
    Join Date
    06-05-2009
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    50

    Re: Fast Single Digit Entering

    Hi Forum Friends
    I'm taking some time off from the Fast Digit Entering problem,
    but will work on it again later.
    Merry Christmas to you all.
    Al

+ 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