+ Reply to Thread
Results 1 to 22 of 22

Userform - complex idea

  1. #1
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Question Userform - complex idea

    Afternoon all, I'm wondering if anyone could help me with a problem i've had all day (and to add insult to misery my PC keeps blue screening )

    Basically I have a single sheet with four weeks (A,B,C and D - Across the top) with a list of Numbers that dont change (Col A) - but the names change with the corresponding weeks (A,B,C and D) This is the data.

    BOOK.xls

    Above is the file that i'm currently on about, i've reverted back to near the begining as the one I have is a real mess

    *The idea* The user should, if at all possible(?) - Select the week in the form (A, B, C or D) and then select a duty - which should then bring up the name. I.e Selecting week "D" and duty 01FT501 should bring up D ROBERTS within the "Name" part of the userform.

    The next part is where I had problems, below is a section "Replace" where the user could type another name (Example Joe Blogs) then hit the tick - to replace "D ROBERTS" with "Joe Blogs"

    I'm not sure if the next part is possible, but the duplicate bit at the bottom was an idea so the user wouldnt have the same nice twice (Like a check) So for Example Z ONGOR is in twice 12SA770 + 12FT001 in "D" week - it would simply list if there was a duplicate

    Sorry for rambling on!

    Any help on this would be great as im totally stuck! Thanks! :beer:
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform - complex idea

    The last part isn't particularly clear, to me anyway.

    What exactly do you want to happen if a duplicate is found?

    Actually there's kind of a problem with the example you give for 12FT001 in week D the name is ONGOR Z, for 12SA770 in the same week the name is Z ONGOR.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: Userform - complex idea

    Ye i've just noticed this also, basically the same person can't be listed twice - I'll be going through it tomorrow and making sure the names are correct - So ONGOR Z will be the same in both cells.

    The duplicate box was just an idea I had, because people get moved around in duties you see. If you notice some have "PT" and some have "FT" (Which is part time and full time) what happens is part timers sometimes get released and moved into a Full Time roll, just for the week (Thats where the replace comes in) but theoretically they could be listed against a part time + a full time duty. The idea of the box was just to list if the same name was in the week more than once.

    I hope that clears it up lol
    Thanks!

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform - complex idea

    So if the person selected to replace is listed more than once in the same week you want the Duty number(s) to be shown in the textbox?

  5. #5
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: Userform - complex idea

    Yep thats it :D

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Userform - complex idea

    A few changes:

    You are using a listbox for the first Name, but there can only be one person for a specific duty for a specific week, so I changed it to a textbox.

    I changed the names of your listboxes and textbox so when reading the code you can tell what they are (e.g., ListBox1 is now listboxDuty).

    I replaced your checkbox with a button to make the replacement. IMHO this is a better user interface design, unless you want them to be able to go back and forth, checking and unchecking the box. That didn't seem likely but if so, let me know.

    I added a Close button.

    Edit: I didn't preview before posting and I see that some conversation has happened since I started. I did not address your duplicate problem. Will revisit that as time permits now that the issue is a bit clearer.
    Attached Files Attached Files
    Last edited by 6StringJazzer; 08-28-2013 at 01:37 PM. Reason: update
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  7. #7
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: Userform - complex idea

    Ye thats exactly what i want thanks! But there is a compile error on the replacing *End if was missing - but when i type the name to replace, it comes up with a msg box and doesnt change

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform - complex idea

    jsneak

    Do you have a list of names anywhere?

    The reason I ask is because I was thinking of using a combobox for the replacement and populating it with all the names.

  9. #9
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: Userform - complex idea

    The list of names you see actually differs in the weeks (A, B, C and D) thats due to people on rotations

    *The replacement works if its left blank but not when there is a name put in :P
    Last edited by jsneak; 08-28-2013 at 01:57 PM.

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform - complex idea

    I know the lists of names are different, I was wondering if you had a full list of all the names.

  11. #11
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: Userform - complex idea

    Ermmmm, no im affraid not some people wont have a duty and they fall under "leave subs"... Otherwise the list would be around about 600+

    As it is now, it works if the "Replace" name is blank ... It makes the name blank on the correct week and duty - it just doesnt work when you add a name So close :D

  12. #12
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: Userform - complex idea

    Basically, if there is away of making the "Replace" text box enter anything you type into it.. it would work :P

    **Update i got it working, thank you so much for helping me mate!

    If Me.textboxReplacement = textboxReplacement.Value Then - is what i had to change, thanks again mate!
    Last edited by jsneak; 08-28-2013 at 03:18 PM.

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform - complex idea

    What if they type a non-existent name in?

  14. #14
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: Userform - complex idea

    Well, thats down to user error if it is :D

    Actually, would the duplicate name be really hard to implement? (Once i go through and change the names to the same like the example one)

    Thanks

    Please Login or Register  to view this content.
    I've made it so that if its blank it comes up with the error too

  15. #15
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Userform - complex idea

    Quote Originally Posted by jsneak View Post
    **Update i got it working, thank you so much for helping me mate!
    Please Login or Register  to view this content.
    That test will always be TRUE! It compares the contents of the textbox to itself, so it will always match.

    I took another look and fixed the compilation problem, which was a missing End If. I apologize, I must have made a change after my test and forgot to re-test.

    I made the first textbox into a label, because the user will never enter data in that field.

    I also dealt with the duplicate issue. The duplicate textbox is now also a label also because the user won't write in it. If there are no duplicates found, there is a message to that effect.

    I changed your Initialize sub to an Activate, so that it blanks out all the fields every time it comes up.

    Let me know if we're getting closer!!
    Attached Files Attached Files

  16. #16
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: Userform - complex idea

    Mate I can't thank you enough, thats ideal!

    Thanks!

    *Actually, would it be possible - if a duplicate was to be found .. To either go to the cell where it was found or an option to remove the name?
    Last edited by jsneak; 08-29-2013 at 11:33 AM.

  17. #17
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Userform - complex idea

    OK, this version selects the cells where the duplicates are found. The code is noticeably different, let me know if you have questions about how it works.
    Last edited by 6StringJazzer; 08-30-2013 at 03:35 PM. Reason: Removed obsolete attachment, see two posts down for correct version

  18. #18
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: Userform - complex idea

    Thanks for your reply, but i dont think its changed ? :P

  19. #19
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Userform - complex idea

    Sorry about that, had a version control issue.
    Attached Files Attached Files

  20. #20
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: Userform - complex idea

    Thanks mate, thats exactly what i wanted!!

    *When i close the file it comes up with an error tho ?
    Last edited by jsneak; 08-30-2013 at 04:50 PM.

  21. #21
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Userform - complex idea

    If you need help with an error, it is essential to provide the details about the error, especially any text shown that describes it.

    Also, please do not edit a post to add another question. Create a new post to ask a question. In my email feed and I just saw the first line of your post, not the second line that you added when you edited. Normally I would not have returned to the thread after seeing that I provided exactly what you wanted (twice!)

  22. #22
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: Userform - complex idea

    Ah ok, when i close the file it comes up "Out of memory" .. Pretty sure 8gb will be enough lol - it's only sometimes, so it might actually be my pc acting up again -.-''

+ 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. Have no idea how to get this done. Please help.
    By Leonard99321 in forum Excel General
    Replies: 4
    Last Post: 08-17-2013, 06:03 AM
  2. Complex userform with user-populated listbox
    By olivierpbeland in forum Excel Programming / VBA / Macros
    Replies: 72
    Last Post: 01-23-2013, 04:18 PM
  3. Creating a "complex" userform
    By AnthonyWB in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-13-2010, 04:04 PM
  4. Complex Userform - Step by Step
    By oberon.black in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-13-2005, 11:08 AM
  5. Checking a complex userform for blank entries
    By WillRn in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-10-2005, 07:05 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