Results 1 to 3 of 3

Thread: Using a button and also checking a checkbox

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    2

    Using a button and also checking a checkbox

    VB is my second language and I am a little rusty. I have a bunch of buttons setup to run macros for a process but when I click the button I also want it to check a checkbox to show that the macro has been run. Any ideas on how this is possible. also will also need to great a macro that clears the checked boxes but I think that should be easy once I figure out how to check the boxes.


    Thanks

  2. #2
    Hyperactive Member
    Join Date
    Oct 2010
    Location
    Indiana
    Posts
    457

    Re: Using a button and also checking a checkbox

    Need more information.

    What are you doing this in? is it excel VBA, are the buttons/checkboxes on a userform in VBA, a VB form, etc...

    The simple answer, since you are talking about macros, I am assuming you are using Excel VBA:
    The Button will have a click event handler. In the click event you simply refer to the checkbox and set it equal to true...
    This assumes your button's name is "btn1", and your checkbox's name is "chkbx1", and it also assumes they are both on the same userform:

    vb Code:
    1. Private Sub btn1_Click()
    2.     Me.chkbx1.Value = True
    3. End Sub

    To uncheck the checkbox, determine which event you want it to occur on, and just set it's value to false.

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    2

    Re: Using a button and also checking a checkbox

    no_one

    Sorry after re-reading what i wrote I left it pretty open. But yes I am working in excel and VBA. I have a spread sheet with buttons on it and then a check box next to it to show that I clicked the button. Thank you for the code, I think it is exactly what I am looking for. I will let you know if I run into any problems.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width