ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Multiple checkboxes (https://www.excelbanter.com/excel-programming/389290-multiple-checkboxes.html)

[email protected]

Multiple checkboxes
 
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.


merjet

Multiple checkboxes
 
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


[email protected]

Multiple checkboxes
 
On 12 May, 21:11, merjet wrote:
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!



All times are GMT +1. The time now is 05:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com