+ Reply to Thread
Results 1 to 7 of 7

Input box in a loop function

  1. #1
    Forum Contributor
    Join Date
    02-12-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007
    Posts
    263

    Input box in a loop function

    Hi All

    I have input box showing 3 numbers . So the operator will select any one of the three
    Incase if he selects other than those three it should pop up a error message and
    The input box should repeat once again, I think this should be in aloop any advise how

    Many Thanx

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Input box in a loop function

    Hi, grkchakri,

    maybe something like
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Input box in a loop function

    Hello grkchakri,

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Forum Contributor
    Join Date
    02-12-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007
    Posts
    263

    Re: Input box in a loop function

    Thanx very much leith, Hahobe

    Both works fine. Just in general. I want to know whats the basic diffrence between Loop and Go to

    Looks like both tend to do the same function As in going back to the input box until user selects one of the numbers
    in the input box message

    Can some one tel me when should wee use loop or goto and if so which one is better. Or they are two diffrent
    nature of functions.

    Many Thanx

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Input box in a loop function

    Hi, grkchakri,

    as I may only speak for myself itīs up to you and how you like it what aproach to use. Using a loop sort of makes the action just one block to run through with a wanted result (leaving the sub on Cancel, repeat as long as the condition is met and then proceed) while I mostly use junmping to a special point in case of Error handling.

    Take it as you want (or as you may implement it into your procedure).

    Ciao,
    Holger

  6. #6
    Forum Contributor
    Join Date
    02-12-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007
    Posts
    263

    Re: Input box in a loop function

    Thanx hahabe
    Ii was just trying to understand the basic difference not to compare any one answers.
    I know both are good answers and it differs from person to person how they code in that situation.

    Thanx anyways

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Input box in a loop function

    Hello grkchakri,

    A loop is used to repeat one or more code statements either a set number of times or until a specific condition is met. A GoTo statement is used to redirect code execution anywhere within the procedure at any time.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. vba input selection and loop running
    By yaleguan in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 01-20-2013, 05:11 AM
  2. [SOLVED] Input Box, Confirm yes/no, if answer = no, loop back to input box
    By lukasj13 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2012, 12:41 PM
  3. Add Loop to Input Box
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-16-2009, 09:39 AM
  4. Collecting textbox input within a for loop
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2006, 03:10 PM

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