Consulting

Results 1 to 6 of 6

Thread: Using a click button to select data relating to checkboxes

  1. #1

    Using a click button to select data relating to checkboxes

    Hi,

    I have tried as much as i can with this and do not seem to be making progress.

    My requirement is to have checkboxes which point to cell references.
    Once the execute button is clicked I want the macro to look at the data that relates to each checkbox and select the data depending upon if the checkbox is true or false.

    I have attached an xls to show as an example of what I would like to do, please note that I have stripped all the VB code as I think I was going in the wrong direction.

    Thanks for any help.

    Lee

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You can check them with

    [vba]

    For Each cb In ActiveSheet.CheckBoxes

    If cb.Value = 1 Then

    End If
    Next cb
    [/vba]

    But what do ypu want to do with the selected checkboxes.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    I think you miss-understand?

    I will manually select the check boxes and then for example.
    If i have selected Contact list 1 and Contact list 3 check box, once i press the execute button i want it to highlight the data on the spreadsheet under Contact list 1 and Contact list 3 fields.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Read what I said, I think you will find I understood perfectly

    [vba]

    Dim rng As Range
    Dim Highlight As Range
    With ActiveSheet

    For Each cb In .CheckBoxes

    If cb.Value = 1 Then

    Set rng = .Rows(1).Find(cb.Caption)
    If Highlight Is Nothing Then

    Set Highlight = Range(rng, rng.End(xlDown))
    Else

    Set Highlight = Union(Highlight, Range(rng, rng.End(xlDown)))
    End If
    End If
    Next cb

    If Not Highlight Is Nothing Then Highlight.Select
    End With
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    Hi, i do apologize after re-reading i can see that you was just asking me exactly what i'm wanting to do with the check boxes.

    Thank you so much, the suggested code has worked perfectly.
    Much appreciated.

    Lee

  6. #6
    Hi,

    Sorry to trouble you again.

    How can i have contact list 1 as a permanent selection?
    and is it possible to have the contact selections on the same column and select them but on multiple worksheets?

    As displayed in the example?

    Really appreciate your help.
    Last edited by N0ble; 06-18-2010 at 03:18 AM.

Posting Permissions

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