+ Reply to Thread
Results 1 to 7 of 7

VBA form / VBA formulier

  1. #1
    Registered User
    Join Date
    01-30-2019
    Location
    Gent, Belgium
    MS-Off Ver
    Office 2010
    Posts
    6

    VBA form / VBA formulier

    I have a problem optimizing an excelform that I made with VBA. Long story short:

    I began programming this form but got stuck on a couple of things

    through another excelforum someone helped me a lot, and upgraded my form in a way that is beyond my expectations but it still has a few glitches and the programming is now beyond my capabilities so I am stuck with a form that I like a lot but I do not have the skillset to tweak it.


    What must the form do?:

    Supervisors can use the form to register employees when they want to go to a training.
    To receive subsidy and for analysis, I need some personal data (like birthdate, gender,....)

    It occurs that you need to register multiple employees for the same training. The way the form is build, you need to fill the form for each employee, I would prefer it if I could choose multiple employees and just needed to fill the info of the training once.

    And the second thing that's not optimal is the privacy. An employee's gender and date of birth should not be visible for every supervisor who fills the form, just for me afterwards to anonimize and analyze.


    This form is made in "dutch" so I don't know if every word in the form is easy to understand, but I think it is. If not I'm glad to translate

    If someone could help me to rectify these small problems, I would be very grateful


    thomas
    Attached Files Attached Files

  2. #2
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: VBA form / VBA formulier

    Hi Thomas,
    attached is yr workbook with an adjusted form.
    In the list "Kies Deelnemer" you can select multiple items.
    The Deelnemer data from in the Info panel are moved outside the panel and so made invisible, but still useable. They are now below the button "Indienen".
    When you click the button "Indienen", the attached procedure (Sub Cmd_00_Click) cycles through the Deelnemers list (LB_00).
    For each item in the list that is selected, the Deelnemer data are copied to the (now hidden) textboxes (T_02 to T_05).
    From there the procedure is unchanged.
    I also commented out the code copying the Deelnemer data when an item in de Deelnemers list is selected, because that'no longer relevant.
    Attached Files Attached Files
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

  3. #3
    Registered User
    Join Date
    01-30-2019
    Location
    Gent, Belgium
    MS-Off Ver
    Office 2010
    Posts
    6

    Re: VBA form / VBA formulier

    Hello Tsjallie,


    this is just perfect! thank you again and again!!



    greetings


    thomas

  4. #4
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: VBA form / VBA formulier

    I had one more request: Is it possible to automatically reset the chosen participants after completing a form? In the current form, after completing a form you need to deselect every participant that you selected in the previous form.
    In the attached form selected participants are deselected once their participation is registered in the table.
    Attached Files Attached Files

  5. #5
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: VBA form / VBA formulier

    I'm having trouble protecting the sheet "deelnemers". I'm using 'ActiveSheet.Protect UserInterfaceOnly:=True' and variants, but I cannot succeed in locking the sheet for users and still allowing data from VBA tot enter the sheet
    Tried that, no problem here.
    At what point are you inserting the command.
    Can you post your workbook again?

  6. #6
    Registered User
    Join Date
    01-30-2019
    Location
    Gent, Belgium
    MS-Off Ver
    Office 2010
    Posts
    6

    Re: VBA form / VBA formulier

    Hello Tsjallie,

    Sorry for the late reply, I've been busy

    I typed the code in "This Workbook"module.


    As you will see in the attachment, I've put 2 types of solution in the module (of course not at the same time when testing), neither of them worked. The one above made sure the document was protected, but when entering new data, there went something wrong, because it only saved one line nothing more, and furthermore when entering new data after that, it would overwrite the previous data.


    The code below did nothing
    Attached Files Attached Files

  7. #7
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: VBA form / VBA formulier

    My bad. UserinterfaceOnly works for cells expect when they're part of table (listobject). Overlooked that.
    If you add the red lines to the code behind the button "Indienen" like this then it'll work fine.
    Please Login or Register  to view this content.

+ 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. Replies: 3
    Last Post: 08-22-2018, 06:42 PM
  2. Replies: 9
    Last Post: 06-13-2017, 03:33 PM
  3. code to create unique alphanumeric form number every time form is opened
    By Ishwarind in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-01-2014, 06:16 AM
  4. Use form submission to enter data both in the form and not in the form
    By tsamuels in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2013, 10:06 PM
  5. Replies: 1
    Last Post: 02-28-2013, 08:17 AM
  6. Filling form fields via worksheet dropdowns, user update via form, change form color
    By Demosthenes&Locke in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2010, 08:58 AM
  7. [SOLVED] Pass variable from form to form to form
    By headly in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-30-2006, 09:50 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