Results 1 to 5 of 5

checkboxes to run multiple ranges of macros

Threaded View

  1. #1
    Registered User
    Join Date
    09-11-2012
    Location
    Rockville, MD
    MS-Off Ver
    Excel 2003
    Posts
    47

    checkboxes to run multiple ranges of macros

    Hello all. I have a massive spreadsheet with 100 columns of checkboxes (not my idea; but I'm stuck with it). Each checkbox is controlled individually; PLUS I want to have a "master" checkbox at the top of each column that will check each chechbox in its column, and control the value and formatting of the adjacent cell. I have created the below code, which does what I want. The problem is with this approach I will have to manually name 2 ranges for each of the 100 columns and modify the sub checkbox code to include the correct names for all one hundred columns of checkboxes.

    I am hoping to have a macro which will point to ranges (row 2 to 313 of the column where the checkbox is located) and then control those ranges depending on the value of the checkbox. Thoughts?

    Sub CheckBox1_Click()
    If ActiveSheet.CheckBoxes("Check Box 1") = xlOn Then
          ActiveSheet.Range("q3checkboxes").Value = 1
          ActiveSheet.Range("q3data").Value = ".N"
          ActiveSheet.Range("q3data").Interior.ColorIndex = 56
          ActiveSheet.Range("q3data").Interior.Pattern = xlSolid
          ActiveSheet.Range("q3data").Font.ColorIndex = 56
    ElseIf ActiveSheet.CheckBoxes("Check Box 1") = xlOff Then
          ActiveSheet.Range("q3checkboxes").ClearContents
          ActiveSheet.Range("q3data").ClearContents
          ActiveSheet.Range("q3data").Interior.ColorIndex = 0
          ActiveSheet.Range("q3data").Interior.Pattern = xlSolid
          ActiveSheet.Range("q3data").Font.ColorIndex = 0
    
    End If
    End Sub
    Last edited by Cutter; 09-18-2012 at 08:45 PM. Reason: Added code tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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