+ Reply to Thread
Results 1 to 11 of 11

Userform - Where to start

  1. #1
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Sefton
    MS-Off Ver
    MS Office 365 ProPlus
    Posts
    131

    Userform - Where to start

    Let me start by I'm not asking anyone to make this form for me, I would rather do it myself so I can learn. I've messed around with userforms in the past but it was a good few years ago, and I ultimately didn't create anything, so I'm after some guidance on where to start and how to proceed.

    I've tried to find some tutorials on youtube, etc but the majority of them seem to be about formatting and design, rather than the back-end and setup.

    I've been passed a fairly large and overly complex spreadsheet regarding employees and their training records, I'm looking to make the whole thing much easier to use and update, and figured a userform would simplify it a lot for the users. A database would probably be best, but my access knowledge is even worse than my userform knowledge.

    Information I need to be visible to the user;
    • Employee Name
    • Employed (Y/N) - Need to still be able to search historical data for those who are no longer employed by the company
    • Department
    • Job Title
    • Certificate Name
    • Completion Date
    • Expiry Date

    Information that needs to be editable by users;
    • Employee Information - Update and Add New
    • Ability to Hide Employees - no longer works for the company but records are still kept
    • Certificate Information - including how many months before certification needs to be renewed
    • Ability to Hide Certifications - should it be superseded with another certification, records still kept
    • Update completion date, when certification has been renewed

    I'm sure if someone can get me started I can figure a lot of it out myself, I'm usually quite good at picking things up once I get going. I'm just struggling to understand how to best layout my data in Excel, and making it accessible and editable by the userform.

    Thanks.

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,177

    Re: Userform - Where to start

    Microsoft database would be better, since it does a lot for you ...like self make user forms.
    otherwise in excel you MUST ADD EVERY BOX & LABEL YOURSELF and then program it, where access can make it in a single click.

    Start now to learn database now and skip the bulky clumsy way excel does it.
    you wont regret it.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,853

    Re: Userform - Where to start

    I cannot speak to the user form itself, but I can to the best way to approach the layout of the data.

    Good data layout is in flatfile (normalised) format, and it looks as though that's what you are aiming for. One row per record - no subheadings in a table, all fields in each row filled in.

    However, in our case, it might be sensible to look at a relational set-up (one table for the employees and their details (unique records) and another for their certification history (multiple rows per employee). This would require a one-to-many relationship, so you'd want to have a unique ID per employee in the master (employee) table that would also be used in the slave (certification) table to link the two together.

    In theory you'd either have a user form that references ad updates both tables, or two forms - one for employee data and another for certification data. This is where someone familiar with user forms will need to step in and advise.

    Hope it's useful.

    PS I agree that Access would be better for this, and there are lots of templates that you could adapt to your own usage.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Sefton
    MS-Off Ver
    MS Office 365 ProPlus
    Posts
    131

    Re: Userform - Where to start

    I understand that a database would suit this project better. However last time I tried to learn Access a lot of it went over my head, and I was struggling for a long time (before I ultimately changed jobs and didn't need to learn it anymore). Whereas I'm already very familiar with Excel, and have a good understanding of VBA - I just really need to know the starting point and I could do this fairly quickly I feel. I spent at least a month trying to learn Access last time, and got pretty much nowhere with the tutorials I was using, and feel I could have this working in Excel, pretty much as needed, inside a week if I knew the basics to getting it running.

  5. #5
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Userform - Where to start

    I would encourage you to use a 'structured table' as your app has the appearance of a 'pseudo' database.
    As you have 'messed around' before with userforms I am assuming you are familiar with the VBA editor.
    The basics of the attached form will give you some pointers, leave the controls (textboxes, combos, etc.,) with their default names, this will allow you to loop through them rather than referencing each individually with 'meaningful' names.
    Declare your variables at the head of the code immediately after 'Option Explicit' - this makes the variable available across the entire app rather than restricting if declared within a sub.
    Your will note this in the case of variable 'sc' this finds the record within the 'listbox' and is then further used by the 'Update' & 'Delete' routines.
    Although not immediately obvious there are textboxes embedded over the comboxes this allows the looping refered to above.
    Lastly to 'Add' a new record first 'Clear' the form this ensure a clean form and activates the 'Add' button - enter your new data and press 'Add' to transfer to sheet.
    Attached is the Excel file and a PDF of the code, the PDF gives a better picture of the code structure and flow.
    Currently ignore the calendar form and its code that is also part of this app as the calendar may not appear complete with MS365 - if you need this at a later date I can supply a compatible version.
    Any questions post back on this site.
    Attached Files Attached Files
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,853

    Re: Userform - Where to start

    Quote Originally Posted by DHFE View Post
    I understand that a database would suit this project better.
    Did you read anything else in my post, or just the last line?

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Userform - Where to start

    Ali's reply has given you a good start by advising you to design your data tables - Employee Information and Certification Information - with "Employee"ID" being the unique key which will link the two tables.

    Once you have these addressed, the Userform aspect is relatively simply with tranfers from Userform to tables (and vice-versa)

    If any management reporting is required, consider this also to ensure you have all the data required: either basic input or calculated/derived values.

    What sort of of volumes are involved: number of employees and number of certificates/certifications.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  8. #8
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Sefton
    MS-Off Ver
    MS Office 365 ProPlus
    Posts
    131

    Re: Userform - Where to start

    Quote Originally Posted by AliGW View Post
    Did you read anything else in my post, or just the last line?
    Yes I did read the rest of your post. I was responding to the post before yours when you responded, so I hadn't read it at that point.

    But you also stated that you aren't familiar with user forms themselves and part of my query having the user form reference the existing data, so I don't have to re-enter it all.

    So thank you for your advice about the data but that isn't all I'm after here.

  9. #9
    Forum Contributor
    Join Date
    10-02-2012
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    252

    Re: Userform - Where to start

    I won't go into too much here but it's best to think of userforms no differently than you do a worksheet.

    For example to programmatically set the value of "A1" on the worksheet "My Sheet" using the value of "C6" from "Their Sheet";
    Please Login or Register  to view this content.
    Using a userform, setting "A1" value with the value found in TextBox1, we'd achieve a similar result as such;
    Please Login or Register  to view this content.
    ("Me" is used by the userform to identify itself, the same can be achieved using the name of the userform, normally "userform1". Also ".Text" can be used in place of ".Value" with a textbox, to specify that the value is exclusively text)

    If you apply the same logic you would creating any other macro, you should be fine.

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Userform - Where to start

    @prizeGotti: good simple explanation!

  11. #11
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Sefton
    MS-Off Ver
    MS Office 365 ProPlus
    Posts
    131

    Re: Userform - Where to start

    Thanks for all the advice everyone. I'll mark this thread as solved, and use it as a jumping off point. If I get stuck further down the line I'll make a new post about the specifics.

+ 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. Multiple timers in a userform does not start..
    By LordRhaine in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-06-2020, 04:09 AM
  2. Start and Stop userform timer
    By SierraKilo78 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-31-2018, 04:26 PM
  3. [SOLVED] Why 2 copies of Userform when using this start sequence
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-17-2017, 10:57 AM
  4. Userform videos_how to start
    By pulsar777 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-08-2016, 01:04 PM
  5. [SOLVED] Userform that Start Data Enty At A Particular Range
    By simpdogg in forum Excel General
    Replies: 5
    Last Post: 04-06-2016, 04:49 PM
  6. [SOLVED] Userform to Start When Workbook Opens
    By JP777 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-06-2012, 10:04 PM
  7. [SOLVED] Loading UserForm on start up.
    By Kobus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2005, 07:06 AM

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