+ Reply to Thread
Results 1 to 6 of 6

Writing VBA code to read checkboxes

  1. #1
    Registered User
    Join Date
    03-18-2008
    Posts
    8

    Question Writing VBA code to read checkboxes

    Hi,

    I an a novice, so please bare with me. I have added form control checkboxes to my spreadsheet (Sheet1). Then I would like to use a ActiveX Command Button that when pressed will return to me how many checkboxes have been checked. Not sure where to begin. Can someone please advise?

    Thanks,

    swb1

  2. #2
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Writing VBA code to read checkboxes

    Swb1

    I'm not in front of my computer at present but each check box is linked to a cell and will show as either true or false.the logic I'd use is to count the number of cells that are 'true'. Do you have an example of your spreadsheet?

  3. #3
    Registered User
    Join Date
    03-18-2008
    Posts
    8

    Question Re: Writing VBA code to read checkboxes

    Yes, I am attaching it now. Thanks for replying!
    Attached Files Attached Files

  4. #4
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Writing VBA code to read checkboxes

    So none of the checkboxes are linked to cells. You could probably write code to check the status of each check box but with the number you've got I suspect this will be a lot of code with if statements. Someone else might know. As stated earlier I think you could avoid all this by linking the check boxes to cells and counting the number of 'True'

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Writing VBA code to read checkboxes

    Hi swb1,

    Instead of using checkboxes it would be much easier to have a column to the left of the words where you put an X if needed. Then you could simply count the number of cells that have X in them instead of trying to deal with check boxes.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  6. #6
    Registered User
    Join Date
    03-18-2008
    Posts
    8

    Question Re: Writing VBA code to read checkboxes

    Yes, I like the X in the column idea and then counting. Thanks! Will try that.

+ 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. Writing a Formula using R1C1 code in VBA code
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-15-2014, 11:06 AM
  2. Help With VBA Code Using Multiple Checkboxes
    By NALynch in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-11-2012, 02:50 AM
  3. Auto read report text file writing parsed fields to workbook
    By tpcervelo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-20-2011, 04:23 PM
  4. VB Code and Checkboxes
    By MBigD011 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-08-2007, 05:37 PM
  5. checkboxes and code
    By Soniya in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-24-2005, 09:35 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