Using check boxes to select multiple non continuous cells

chart

New Member
Joined
Aug 19, 2006
Messages
4
Hello all

I've lurked here for some time and have seen many clever and varied solutions to problems posed. I'm hoping someone can give me an idea on this one.

I've got a sheet with some 40 or so check boxes representing project requirements. I also have a list of ~200 text filled cells, each of which correspond to necessary actions. What I'm trying to determine is the code to allow me to select certain cells from the list based on the check box(s) selected. Different project requirements might share the same options.

For example

selecting checkbox1 might select cells A1, A3, A4, A17
selecting checkbox2 might select cells A1, A2, A3, A15

and selecting both would select A1, A2, A3, A4, A15, A17

Any ideas would be appreciated.

Charlie
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Assign all of the checboxes to this macro

Code:
Sub DeletDuplicates()

    With ActiveSheet
    
        .Range("A1").Select
        
        If .CheckBoxes("Check Box 1").Value = 1 Then _
            .Range("A1, A3, A4, A17").Select
            
        If .CheckBoxes("Check Box 2").Value = 1 Then _
            Union(Selection, .Range("A1, A2, A3, A15")).Select
            
        'etc.
    End With
    
End Sub
 
Upvote 0
Sometime is depend on what kind of checkbox you are using. The checkbox from "Form" toolbar behave differently from the checkbox from VB toolbar. If you use the VB checkbox then just do as XLD had posted. If you are using the checkbox from the "Form" toolbar then do this.
1. Make sure that the "Form" toolbar show floating
2. Right click on the checkbox to select it
3. Click on viewcode icon on the Form Toolbar
4. Enter this in the checkbox sub: Range("A1, A3, A4, A17").Select. If the these ranges are in different sheet make sure you enter as: sheets("Sheet2").Range("A1, A3, A4, A17").Select
5. Please note Form checkbox sub cannot take complicate code. Complicate code need to use VB checkbox.
 
Upvote 0
Sometime is depend on what kind of checkbox you are using. The checkbox from "Form" toolbar behave differently from the checkbox from VB toolbar. If you use the VB checkbox then just do as XLD had posted. If you are using the checkbox from the "Form" toolbar then do this.

My code was for Forms checkboxes.

5. Please note Form checkbox sub cannot take complicate code. Complicate code need to use VB checkbox.

What exactly do you mean by this?
 
Upvote 0
Dear All.


Can you please tell me what is wrong in this code

Private Sub CommandButton1_Click()


If CheckBox1.Value = True Then
Range("a1:b7").AutoFilter Field:=1, Criteria1:="A"

GoTo jump1
Else
If CheckBox1.Value = False Then
GoTo jump1
jump1:
If CheckBox2.Value = True Then
Union(Selection, Range("a1:b7")).AutoFilter Field:=1, Criteria1:="B"

GoTo jump2
Else
If CheckBox2.Value = False Then
GoTo jump2
jump2:
If CheckBox3.Value = True Then
Union(Selection, Range("a1:b7")).AutoFilter Field:=1, Criteria1:="C"


End If
End If
End If
End If
End If
End Sub

Regards,
Srivardhan
 
Upvote 0
That is easy:

- you are hi-jacking someone else's thread
- it has Gotos
- the Gotos goto the next line
- we have no idea what it is supposed to do as you omit to tell us
- you cross-posted this at http://www.vbaexpress.com/forum/showthread.php?t=29514 where you have received much help

First rule, help yourself, don't expect people to guess what you want, and then rudely wander off elsewhere when you fail to properly explain what you need.
 
Upvote 0

Forum statistics

Threads
1,215,734
Messages
6,126,542
Members
449,316
Latest member
sravya

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top