+ Reply to Thread
Results 1 to 8 of 8

VBA: Userform Checkboxes T/F based on ws Cell values

  1. #1
    Registered User
    Join Date
    10-21-2008
    Location
    NC
    MS-Off Ver
    MS Excel 2007
    Posts
    41

    Question VBA: Userform Checkboxes T/F based on ws Cell values

    Hello,

    So after much fumbling I figured out how to loop through my userform checkboxes and get the results to post to my ws. However when I call the userform back up I want the checkboxes to be populated accordingly. I have tried countless different strategies to no avail. Any guidance would be awesome!

    Here is the code I'm using to populate the WS:
    Please Login or Register  to view this content.
    and here is the problem child I cannot get to work:
    Please Login or Register  to view this content.

  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: VBA: Userform Checkboxes T/F based on ws Cell values

    How does your code not work?

    I think it should, though there might be possible to tidy it up a bit.
    Please Login or Register  to view this content.
    Of course that's untested - perhaps you could attach a sample workbook so it could be.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    10-21-2008
    Location
    NC
    MS-Off Ver
    MS Excel 2007
    Posts
    41

    Re: VBA: Userform Checkboxes T/F based on ws Cell values

    Hey Norie, thanks for taking a look at this. I guess some further explanation may be needed to. So if the checkbox name is found in the range then the checkbox.value = false. I attached the the spreadsheet. Please ignore the mess in the vba section. I've been keeping all my attempts and commenting them out as they don't work.
    Attached Files Attached Files

  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: VBA: Userform Checkboxes T/F based on ws Cell values

    The code I posted kind of works, with a little tweak.
    Please Login or Register  to view this content.
    Mind you there seems to be a lot more going on thatn the checkboxes.

    What are you doing and what do you need help with?
    Last edited by Norie; 01-29-2013 at 11:48 AM.

  5. #5
    Registered User
    Join Date
    10-21-2008
    Location
    NC
    MS-Off Ver
    MS Excel 2007
    Posts
    41

    Re: VBA: Userform Checkboxes T/F based on ws Cell values

    so I'm trying to build a virtual checklist. When someone calls the form they will check whether or not something is present in the file. If a checkbox is unchecked the name of the checkbox (which will be the name of the missing item after I figure the code) will populate a cell. When later the user receives the item I want them to be able to pull up the form and have it populate with what is in file and what is missing based on previous entries in the checkboxes.

    What I'm thinking might work best is setting all the checkboxes to "Checked" and then if the loop finds the name of a checkbox in the range then it will change the checkbox value to unchecked. So far no matter what I do I cannot even mange to get a checkbox to show as checked when calling up the form.

  6. #6
    Registered User
    Join Date
    10-21-2008
    Location
    NC
    MS-Off Ver
    MS Excel 2007
    Posts
    41

    Re: VBA: Userform Checkboxes T/F based on ws Cell values

    Update, just tried your tweaked code. It does almost get me there. It just would need to be in reverse. The checkbox it is checking should be unchecked, and the other two should be checked.

  7. #7
    Registered User
    Join Date
    10-21-2008
    Location
    NC
    MS-Off Ver
    MS Excel 2007
    Posts
    41

    Re: VBA: Userform Checkboxes T/F based on ws Cell values

    I kept playing with it and got it sorted (at least this portion of the puzzle). Code if anyone is interested:

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    08-16-2012
    Location
    Florida
    MS-Off Ver
    Excel 2016
    Posts
    33

    Re: VBA: Userform Checkboxes T/F based on ws Cell values

    A question about a slightly different approach...

    If it was a multi-user file, I would think to write their data, including the user name, into a row of the spreadsheet. When they return, you could do a simple vlookup for each of your check boxes, based upon their name (say after pressing a "Returning user" button). You could then set the proper value for the check boxes based upon the lookup. They could then change the values as needed, and hit submit.

    What would be the advantage of either of these two methods?

    BobR

+ 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