+ Reply to Thread
Results 1 to 9 of 9

Userforms and Cell Selection

  1. #1
    Registered User
    Join Date
    06-10-2011
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    9

    Userforms and Cell Selection

    Hi Everyone,

    I've got two things I need help with:

    1. Userforms

    So right now I have a form that shows as this:
    \1

    I'm trying to make it so that when they hit enter, the form is hidden. My code:

    Please Login or Register  to view this content.
    And it doesn't work. And while I'm here, how do I make the form show up at pos x,y?

    Also, is there a way to remove the form from memory after I save the desired values, instead of simply hiding it?

    ---

    2. I've also got a question about selecting cells. Basically I have 2 spreadsheets. The first one is a data set with 2 columns, Owner and Process and it looks like this:

    Some header text
    More random text
    Owner Process
    A ||||||||| blah
    A ||||||||| something
    B ||||||||| 324
    B ||||||||| nothing
    B ||||||||| something else
    C ||||||||| bleh
    D ||||||||| hello
    D ||||||||| text

    I'm trying to make a macro for a 2nd spreadsheet, where it will create a worksheet named after each owner (So 4 worksheets will be made), and in each one the processes owned will be listed in Column A starting from row 3. How do I reference other spreadsheets/worksheets, and how do I specify for it to start searching from the 4th row (ignoring all the header text)?

    Thanks for any help!
    Last edited by MediocreJoker; 06-10-2011 at 12:38 PM.

  2. #2
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: Userforms and Cell Selection

    Ad1 try this way:

    copy it into userform code
    Please Login or Register  to view this content.
    display position:
    set property for your UserForm
    - StartUpPosition = 0- Manual
    and then you can use this:
    Please Login or Register  to view this content.
    Best Regards
    Last edited by MaczaQ; 06-10-2011 at 02:21 PM. Reason: positioning update

  3. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Userforms and Cell Selection

    There is a lady at my work that has a workbook with at least 12 forms in it. Instead of unloading each form after showing the "next" form, she used the hide method. She was having a lot of problems and asked me for help. Among other solutions to her problem, I asked her to use the unload me command to see if it made a difference for her and it did. I don't actually know if that was the solution to her problems because of the other suggestions I gave her, but I thought that hiding forms could be problematic. The only time I use hide/unhide is with frames.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  4. #4
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Smile Re: Userforms and Cell Selection

    Ad 2. check attached solution ... I think all your conditions are covered.

    Best Regards
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-10-2011
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Userforms and Cell Selection

    Thanks! Your solution for #2 was a great help.

    However, I still cannot get the userform working.

    Please Login or Register  to view this content.
    The userform won't go away after pressing Enter (is it KeyCode 13?)

    Edit: I just tried bashing my "Enter" key twenty times and it worked, once. Why does it take so many tries?
    Edit2: Hmm, after playing around with it, it seems to work consistently if I press Enter at the same time as I click the NameEntry box. What is wrong with this lol.
    Last edited by MediocreJoker; 06-10-2011 at 04:23 PM.

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Userforms and Cell Selection

    I'd prefer:

    Please Login or Register  to view this content.
    Last edited by snb; 06-10-2011 at 05:26 PM.



  7. #7
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: Userforms and Cell Selection

    AD 1.

    Please check my working example (attached file) - it have to work.
    I suspect that you have to many code lines in your project

    Best Regards
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    06-10-2011
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Userforms and Cell Selection

    OK, your file works, but I'm VERY confused.

    Basically, I dragged your Userform into my worksheet. It Works. I dragged my Userform into your worksheet, it works. I tried my userform in my worksheet, it doesn't work.

    I've attached my spreadsheet. If you test your userform it works. if you test my userform, it doesn't. This is in the SAME spreadsheet with the SAME code. Why is this happening ;(
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: Userforms and Cell Selection

    in your userform you use "me.hide" whilst you should use "unload me"

    best regards

+ 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