+ Reply to Thread
Results 1 to 13 of 13

Userform textboxes to populate with Cell data and sum if checkboxes ticked

  1. #1
    Registered User
    Join Date
    02-08-2013
    Location
    Taunton, Somerset, UK
    MS-Off Ver
    Excel 2007
    Posts
    85

    Userform textboxes to populate with Cell data and sum if checkboxes ticked

    Hi Gurus...

    After trawling through and through for hours on the internet, I cannot find a simple guide on how to do UserForm programming.
    Can anyone point me in the direction of an online guide that describes functions and how to implement them?

    I am making a user form to add discounts, similar to the attached simplified version -
    Firstly, how do you populate a textbox with cell data?
    Then, I need to have another box that adds up all the discounts that are ticked, and when you click ok, the total is then added to the discount cell on the worksheet.

    Please help - my example is attached with more detail on what I need....
    Attached Files Attached Files
    =IF(Richard="Gets Help",Richard=,Richard=Keh?)

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,957

    Re: Userform textboxes to populate with Cell data and sum if checkboxes ticked

    Quote Originally Posted by RichardJSigKits View Post
    Can anyone point me in the direction of an online guide that describes functions and how to implement them?
    I like John Walkenbach's Power Programming with Excel VBA series.... it's a book, but it is easy to find in libraries or used, and it is very good.

    Try this file, attached.

    BD Test.xlsm
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    02-08-2013
    Location
    Taunton, Somerset, UK
    MS-Off Ver
    Excel 2007
    Posts
    85

    Re: Userform textboxes to populate with Cell data and sum if checkboxes ticked

    Hey Bernie.

    Perfect. Job done.

    Thank you so much for this - Looking at your code, I don't think I would ever have got there with this on my own!

    I'll check out John Walkenbach - Thanks for the heads up on this.

    You're a star and a half, my friend, thank you!

  4. #4
    Registered User
    Join Date
    02-08-2013
    Location
    Taunton, Somerset, UK
    MS-Off Ver
    Excel 2007
    Posts
    85

    Re: Userform textboxes to populate with Cell data and sum if checkboxes ticked

    Hi Bernie.

    One last thing....

    How can I launch this from another user form instead of a CommandButton?

    I have this user form (FrmUpdate), which is an edit form, where the user can click on the category they want to edit, and then they are directed to the right place when they click ok:

    Please Login or Register  to view this content.
    As you can see in the code, I have decided to add the 'Apply Discount(s)' to be launched from this UserForm.
    It works fine, but FrmUpdate stays open behind FrmDiscount, which needs to close as soon as FrmDiscount is activated.

    I have played around with a few options, but it keeps crapping out on me....

    Thanks again!

  5. #5
    Registered User
    Join Date
    02-08-2013
    Location
    Taunton, Somerset, UK
    MS-Off Ver
    Excel 2007
    Posts
    85

    Re: Userform textboxes to populate with Cell data and sum if checkboxes ticked

    Hi Guys / Bernie.

    Scratch that - Sorted it with another Unload Me right after the FrmDiscount.Show event....

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,957

    Re: Userform textboxes to populate with Cell data and sum if checkboxes ticked

    Quote Originally Posted by RichardJSigKits View Post
    Hi Guys / Bernie.

    Scratch that - Sorted it with another Unload Me right after the FrmDiscount.Show event....
    You can also use

    Me.Hide

    instead of

    Unload Me

    in case you need to go back to that userform.

  7. #7
    Registered User
    Join Date
    02-08-2013
    Location
    Taunton, Somerset, UK
    MS-Off Ver
    Excel 2007
    Posts
    85

    Re: Userform textboxes to populate with Cell data and sum if checkboxes ticked

    Quote Originally Posted by Bernie Deitrick View Post
    You can also use

    Me.Hide

    instead of

    Unload Me

    in case you need to go back to that userform.
    Hi Bernie.

    Good Call, My Friend, that makes a lot more sense, in fact it has now enabled me to add a comments box in which the user can explain the discount they have added for the Manual discount value, which of course will still be visible the next time the userform is called upon!
    Brilliant, cheers!

  8. #8
    Registered User
    Join Date
    02-08-2013
    Location
    Taunton, Somerset, UK
    MS-Off Ver
    Excel 2007
    Posts
    85

    Re: Userform textboxes to populate with Cell data and sum if checkboxes ticked

    BD Test RJEdit.xlsm
    Quote Originally Posted by Bernie Deitrick View Post
    You can also use

    Me.Hide

    instead of

    Unload Me

    in case you need to go back to that userform.
    Okay - Have discovered an issue - This only keeps the added data on the UserForm form while the workbook is open, as soon as you save and close the workbook and come back to it, the data is gone and the form is reset...
    So, Presumably, I need the textboxes to pre-populate with data it reads from cells when it loads in order to open and to include any data?

    So, what I would appear to need now is some hidden cells that will populate with all data the applied to the Userform, to which the userform will refer when opened?

    Please see attached amended version of Bernies previous model.

    Anyone fancy having a stab at the code to this?... Please?...

  9. #9
    Registered User
    Join Date
    02-08-2013
    Location
    Taunton, Somerset, UK
    MS-Off Ver
    Excel 2007
    Posts
    85

    Re: Userform textboxes to populate with Cell data and sum if checkboxes ticked

    Hi Guys - can anybody help with this at all, please?

  10. #10
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,957

    Re: Userform textboxes to populate with Cell data and sum if checkboxes ticked

    Sorry I missed your post - I don't know where the amended post is, so post the workbook that you have currently.

  11. #11
    Registered User
    Join Date
    02-08-2013
    Location
    Taunton, Somerset, UK
    MS-Off Ver
    Excel 2007
    Posts
    85

    Re: Userform textboxes to populate with Cell data and sum if checkboxes ticked

    Quote Originally Posted by Bernie Deitrick View Post
    Sorry I missed your post - I don't know where the amended post is, so post the workbook that you have currently.
    Thanks!

    It is attached, but I think I did it 'In-Line'.... Hopefully this will work?
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,957

    Re: Userform textboxes to populate with Cell data and sum if checkboxes ticked

    Try this version - I added in two named ranges that are used to store the values from the userform when the apply button is ppressed. Not sure if I got your workflow the way you want it, but it should be closer....

    BD Test RJEdit.xlsm

  13. #13
    Registered User
    Join Date
    02-08-2013
    Location
    Taunton, Somerset, UK
    MS-Off Ver
    Excel 2007
    Posts
    85

    Re: Userform textboxes to populate with Cell data and sum if checkboxes ticked

    Quote Originally Posted by Bernie Deitrick View Post
    Try this version - I added in two named ranges that are used to store the values from the userform when the apply button is ppressed. Not sure if I got your workflow the way you want it, but it should be closer....

    Attachment 313366
    Perfect, perfect, perfect! - I thank you, kind Sir!
    This is the nuts and bolts to what I need, and so now I can just do the tweaking it needs to suit.

+ 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. [SOLVED] add 2 more frames to existing UserForm VBA to populate textboxes
    By chriswhite1982 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-05-2014, 05:47 PM
  2. When Userform CheckBbox is ticked its 'caption' name to populate spreadsheet
    By Stratfordoaks in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-11-2013, 04:30 PM
  3. Userform populate listbox with search from multiple textboxes
    By chendysworld in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-12-2012, 11:12 AM
  4. [SOLVED] Populate listbox columns with entries from textboxes on userform
    By AndyE in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2012, 11:05 PM
  5. Populate Userform with Checkboxes for each value in column A
    By Bluewhistler in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-20-2010, 03:02 AM

Tags for this Thread

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