Multiple checkboxes

M

martin.a.john

I am working with a sheet that contains on average 100 items. Next to
each record I would like to place a checkbox.

Therefore, how do I:
1. Assign that checkbox to that particular row (as it looks like the
checkbox is floating on the sheet and not assigned to a cell), so that
when that checkbox is selected it identifies that the information in
that active row needs to be selected

2. When the checkbox is unchecked for the row to be returned to its
original state (i.e. is there a statement such as checkbox = false
then ... )

any help greatly appreciated as my knowledge of using checkboxes is
very limited.
 
M

merjet

Here is a macro that puts CheckBoxes in cells A1:A10 of Sheet1 and
makes B1:B10 the LinkedCells. Modify to suit.

Hth,
Merjet


Sub Macro1()
Dim ws As Worksheet
Set ws = Sheets("Sheet1")
Set rng = ws.Range("A1:A10")
For Each c In rng
With ws.OLEObjects.Add( _
ClassType:="Forms.CheckBox.1", _
Link:=False, _
DisplayAsIcon:=False, _
Left:=c.Left, _
Top:=c.Top, _
Width:=c.Width, _
Height:=c.Height)
.Object.Caption = ""
.LinkedCell = c.Offset(0, 1).Address
.Object.Value = False
End With
Next c
End Sub
 
M

martin.a.john

Here is a macro that puts CheckBoxes in cells A1:A10 of Sheet1 and
makes B1:B10 the LinkedCells. Modify to suit.

Hth,
Merjet

Sub Macro1()
Dim ws As Worksheet
Set ws = Sheets("Sheet1")
Set rng = ws.Range("A1:A10")
For Each c In rng
With ws.OLEObjects.Add( _
ClassType:="Forms.CheckBox.1", _
Link:=False, _
DisplayAsIcon:=False, _
Left:=c.Left, _
Top:=c.Top, _
Width:=c.Width, _
Height:=c.Height)
.Object.Caption = ""
.LinkedCell = c.Offset(0, 1).Address
.Object.Value = False
End With
Next c
End Sub

This is cool, thanks so much.
It solved a lot of problems and my time from manually creating check
boxes.

good work!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top