Consulting

Results 1 to 6 of 6

Thread: inputBox default input in code, user not input

  1. #1
    VBAX Regular
    Joined
    Feb 2016
    Posts
    74
    Location

    inputBox default input in code, user not input

    Hi, Partners,

    i want a InputBox that not shows the screen msgbox, only exists in code, his "user value" is entered in code vba and not by user in worksheet.
    i need too other option instead InputBox.

    i try ForNext and not works.

    the problem is: I need restart the code in a loop, increases the value of "4 to 125" (4 to 4), (5 to 5) , (6 to 6) etc.

    the array Array(1) have a error " Run-time error '57121': Application-defined or object-defined error"

    thanks!

  2. #2
    VBAX Regular
    Joined
    Feb 2016
    Posts
    74
    Location
    .
    like this: i define the value (answer of the user) of Inputbox = 4, then, the vba code simulate click on button "OK" then que answer of the user is number "4".
    this trick is a workaround to update the value of inputbox and not show the Msbox of Inputbox.


    How can I do this ??

  3. #3
    VBAX Regular
    Joined
    Feb 2016
    Posts
    74
    Location
    Hi,

    Like TimeOut, Temporized Inputbox, not other, only Inputbox.


    Automatically answer "Yes" to DefaultValue without shows the screen of Inputbox.
    The time will be very very small.

    i read about Application.ScreenUpdating = True and Application.DisplayAlerts = False

    like this code, but in same procedure (Sub) :

    by Mikerickson
    'http://www.vbaexpress.com/forum/showthread.php?15820-Inputbox-amp-Time

    Sub mainRoutine(Optional skipFirstPart As Boolean) 
         
        If skipFirstPart Then GoTo endHalf 
         
        Rem some code 
         
        Application.OnTime Now + TimeValue("0:0:30"), "Skipper" 
        UserInput = Application.InputBox("enter something") 
        Application.OnTime proceedure:="Skipper", schedule:=False 
         
    endHalf: 
        Rem more code 
    End Sub 
     
    Sub Skipper() 
        Call mainRoutine(True) 
        End 
    End Sub
    edit: look i edited the post.

  4. #4
    VBAX Regular
    Joined
    Feb 2016
    Posts
    74
    Location
    http://www.vbaexpress.com/forum/edit...&postid=360092

    Quote Originally Posted by Logit View Post
    proceedure =procedure
    Logit,

    yes, i fix this mistake, but gives other error "argument is not optional" (free translating of Portuguese) in this line: Application.OnTime

    if fix this with put the time after Ontime, and stop the error message.
    but i not make this work.

    i need return the answer of Inputbox.
    i set automatically answer to number value:"4" and i need return this value in a variable long.

    Logit, please, help me in my Thread:
    http://www.vbaexpress.com/forum/show...user-not-input


    attached sample file

    Attachment 18990


    Attachment 18989

  5. #5
    VBAX Regular
    Joined
    Feb 2016
    Posts
    74
    Location
    Hi, mikerickson,

    ok, you maybe help me on my thread in link above.
    in your code, not shows the Inputbox like the OP speak in first post. I not understand.

    i need invoke the INputbox to erase (re-start) only 1one variable of array afther Redim.
    i need increases the value of one ForNext Loop (1 to 125) and clean the variable to re-start in 2 (not preserve first 1)
    If i only change the value (1 to 2, 2 to 2 , etc ) adn click on commandbutton in worksheet the code runs ok.
    but if i use 1 to 125 gives error.

    i think if i invoke inputbox and this uptade the code will clean old value of ForNext in the Array and will works.

    thanks.

  6. #6
    VBAX Regular
    Joined
    Feb 2016
    Posts
    74
    Location
    Logit, thanks very, very mutch.
    i consider using this userform if I do not find another solution.
    I really consider use it
    But I still want to try another more practical way that every time I need to create or find a userform.


    I am preparing a sample file with my original code.
    Maybe I do not prevail on an Inputbox but rather just referesh the code, problem i need refresh the code with new value (increment the value in start the code , like 1 , 2, 3, 4, etc.

    look:
    ''----------------------------------------------
    http://www.vbaexpress.com/forum/show...utbox-amp-Time
    Hi, mikerickson,

    ok, you maybe help me on my thread in link above.
    in your code, not shows the Inputbox like the OP speak in first post. I not understand.

    i need invoke the INputbox to erase (re-start) only 1one variable of array afther Redim.
    i need increases the value of one ForNext Loop (1 to 125) and clean the variable to re-start in 2 (not preserve first 1)
    If i only change the value (1 to 2, 2 to 2 , etc ) adn click on commandbutton in worksheet the code runs ok.
    but if i use 1 to 125 gives error.

    i think if i invoke inputbox and this uptade the code will clean old value of ForNext in the Array and will works.

    thanks.

    edit: i not understand Inputbox not shows.
    edit: Mike, please a sample file with your code like your think, please, i think will help me.

Posting Permissions

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