+ Reply to Thread
Results 1 to 12 of 12

Programming a user form

  1. #1
    Registered User
    Join Date
    04-15-2009
    Location
    morristown, ny
    MS-Off Ver
    Excel 2007
    Posts
    39

    Programming a user form

    I need help to get the macros right to do the following that it can not do now:

    I would like the user to be able to pause in between input areas and do others things.

    Need for the input length to be varible or grow with the information

    Are these things possible?
    Last edited by ed ayers315; 10-27-2009 at 06:56 AM.

  2. #2
    Registered User
    Join Date
    10-11-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    59

    Re: Programming a user form "Excel" with macros

    Hi,

    I would recomend a Userform rather than a series of unvalidated imput boxes that force the user to go through each one. A userform will allow the user to exit at will and may be easier to validate.



    Consider RoyUK's site for an example of how this can be done.
    http://www.excel-it.com/vba_examples.htm

  3. #3
    Registered User
    Join Date
    04-15-2009
    Location
    morristown, ny
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Programming a user form "Excel" with macros

    Thank you for your suggestion. I tried the user form approach but could not get it to print correctly. It would cut out some of the text box information and break in the middle of a page. I also needed the information on that user form to be compiled to a history.

    Any advice on that would be great. I will check out J & R link.

    Again thank you!

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

    Re: Programming a user form "Excel" with macros

    You don't print a userform, you save the input to a formatted sheet & print the sheet. You already have the sheet.

    Your code needs some major tidying. Remove all those small scroll commands. also, you don't need to select the rages, that's why the screen "flickers"
    Last edited by royUK; 10-24-2009 at 09:33 AM.
    Hope that helps.

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

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    04-15-2009
    Location
    morristown, ny
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Programming a user form "Excel" with macros

    That's great news. Can I have the sheet on one tab and the form on another or do I need to put my form parts over the cells they will be linked to fill in? Also, how do you move from one text box to the next one for the user to fill in?

    Thank you

  6. #6
    Registered User
    Join Date
    10-11-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    59

    Re: Programming a user form "Excel" with macros

    Hello,

    If you use a userform, the activesheet can be any sheet. In other words, the form does not have to be near the cell or on the sheet where the data will eventually end up. Once the user has filled the desired textboxes / fields, they can click a command button that will transition the data from the form to the appropriate sheet.

    To move from one field to the next on a Userform, the user simply tabs over. Simply adjust the tab index property of the userform.

    RoyUk's sample Dataform should get you started . . .

  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: Programming a user form "Excel" with macros

    Quote Originally Posted by ed ayers315 View Post
    That's great news. Can I have the sheet on one tab and the form on another or do I need to put my form parts over the cells they will be linked to fill in? Also, how do you move from one text box to the next one for the user to fill in?

    Thank you
    I think you need to read a little about userForms. You can also see an example here

    http://excel-it.com/vba_examples.htm

    Look at the database form

  8. #8
    Registered User
    Join Date
    04-15-2009
    Location
    morristown, ny
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Programming a user form "Excel" with macros

    What you suggested helped out a lot. I have attached a the file with 4 user forms linked to the Excel work sheet. I can not figure out How to get the user form to come up fro the user to fill out and then get to the next page.

    Any suggestions would be appreciated, thanks.

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

    Re: Programming a user form "Excel" with macros

    Why 4 userforms?

    Why save it as a template before it is finished?

    You have added a Multipage whicj is fine, but you put the controls on the MultiPage Tabs, not separate UserForms.

    This last is personal opinion, but I really don't think the bright coours in the UserForms are necessary
    Last edited by royUK; 10-25-2009 at 11:30 AM.

  10. #10
    Registered User
    Join Date
    04-15-2009
    Location
    morristown, ny
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Programming a user form

    All very good questions

    1. I could not get a page break or make the page long enough. I did not think to go sideways until I starting answering you back.

    2. I did that trying other things before your last reply.

    3. I deleted that out and used macro buttons to move to each page. The reason for this is one user will use Page 1-2 and a different person will do 3 -4.


    I'll try cutting the other pages and going sideways unless there is a way to go down further

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

    Re: Programming a user form

    I would stick to the 4 pages, your form is rather large and difficult to display. I have a widescreen laptop & it does no display well. Don't make the controls igger than necessary

  12. #12
    Registered User
    Join Date
    04-15-2009
    Location
    morristown, ny
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Programming a user form

    RoyUK,

    Thank you very much for your help, I have a working template/form. I do have a couple new questions that I will start new thread/s.

    Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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