#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default check boxes

I need to set-up some check boxes or option boxes and need to have two
funtionalities. I do not have any knowledge on this, so if you can help,
please be as descriptive as possible.

(1) will have two columns with a check box in each for every row, where
users can select one of the two options. I need it to be set-up to where if
you select the option in column E, you can't select the one in column F -
only one or the other.

(2) I need to set-up a select all for each column (E & F) so that if someone
wants to select all the options in column E, they can click the box and all
the boxes below in column E are automatically checked/clicked.

THanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default check boxes

Can anyone help? Thanks!

" wrote:

I need to set-up some check boxes or option boxes and need to have two
funtionalities. I do not have any knowledge on this, so if you can help,
please be as descriptive as possible.

(1) will have two columns with a check box in each for every row, where
users can select one of the two options. I need it to be set-up to where if
you select the option in column E, you can't select the one in column F -
only one or the other.

(2) I need to set-up a select all for each column (E & F) so that if someone
wants to select all the options in column E, they can click the box and all
the boxes below in column E are automatically checked/clicked.

THanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default check boxes

I wouldn't use checkboxes for this kind of thing. I'd use optionbuttons. If
those optionbuttons are grouped correctly, then only one of the buttons can be
selected at any time. You don't have to do anything special.

If you want to try this...

Option Explicit
Sub SetupOneTimeOnly()

Dim GrpBox As GroupBox
Dim OptBtn As OptionButton
Dim myRng As Range
Dim myCell As Range
Dim wks As Worksheet
Dim iCtr As Long
Dim maxBtns As Long

Set wks = Worksheets("Sheet1")
maxBtns = 2

With wks

'clean up existing junk
.GroupBoxes.Delete
.OptionButtons.Delete

Set myRng = .Range("e2:E20") 'left most column only

For Each myCell In myRng.Cells
With myCell.Resize(1, maxBtns)
Set GrpBox = wks.GroupBoxes.Add _
(Top:=.Top, Left:=.Left, _
Height:=.Height, Width:=.Width)
With GrpBox
.Caption = ""
.Visible = True 'False
If myCell.Row = myRng.Cells(1).Row Then
.Name = "GRP_Parent_" & myCell.Address(0, 0)
Else
.Name = "GRP_Child_" & myCell.Address(0, 0)
End If
End With
End With
For iCtr = 0 To maxBtns - 1
With myCell.Offset(0, iCtr)
Set OptBtn = wks.OptionButtons.Add _
(Top:=.Top, Left:=.Left, _
Height:=.Height, Width:=.Width)
OptBtn.Caption = ""
OptBtn.Name = "OPT_" & Format(iCtr, "00") _
& "_" & myCell.Address(0, 0)
If iCtr = 0 Then
With myCell.Offset(0, -2)
OptBtn.LinkedCell = .Address(external:=True)
End With
End If
If myCell.Row = myRng.Cells(1).Row Then
OptBtn.OnAction _
= "'" & ThisWorkbook.Name & "'!ChangeAllBtns"
End If
End With
Next iCtr
Next myCell
End With
End Sub
Sub ChangeAllBtns()

Dim MstrBtn As OptionButton
Dim OptBtn As OptionButton

Set MstrBtn = ActiveSheet.OptionButtons(Application.Caller)

For Each OptBtn In ActiveSheet.OptionButtons
If LCase(OptBtn.GroupBox.Name) Like LCase("GRP_Child*") Then
If LCase(Left(OptBtn.Name, 6)) Like _
LCase(Left(MstrBtn.Name, 6)) Then
OptBtn.Value = xlOn
End If
End If
Next OptBtn
End Sub

I filled in E2:F20 with optionbuttons.

A lot of this code was taken from Debra Dalgleish's site:
http://www.contextures.com/xlForm01.html

You may want to review that, too.


wrote:

I need to set-up some check boxes or option boxes and need to have two
funtionalities. I do not have any knowledge on this, so if you can help,
please be as descriptive as possible.

(1) will have two columns with a check box in each for every row, where
users can select one of the two options. I need it to be set-up to where if
you select the option in column E, you can't select the one in column F -
only one or the other.

(2) I need to set-up a select all for each column (E & F) so that if someone
wants to select all the options in column E, they can click the box and all
the boxes below in column E are automatically checked/clicked.

THanks.


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy and move check box (check boxes) with new cell link? Marty Excel Worksheet Functions 1 January 20th 10 07:43 PM
How do I increase the size of check in check boxes Adams, Les Excel Discussion (Misc queries) 0 September 19th 06 02:35 PM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM
How do i create a value for check boxes or option boxes Tim wr Excel Discussion (Misc queries) 1 February 9th 06 10:29 PM
Check Box influencing other Check Boxes Dave Ramage[_2_] Excel Programming 0 September 4th 03 02:14 PM


All times are GMT +1. The time now is 03:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"