Try the below macro...In a fresh workbook place 5 checkboxes in say cell B1
to B5. The below macro will link these to cells A1 to A5 respectively..
Sub Macro()
Dim intRow As Integer
Dim ws As Worksheet, obj As OLEObject
Set ws = Sheets("Sheet1")
For Each obj In ws.OLEObjects
If TypeName(obj.Object) = "CheckBox" Then
obj.LinkedCell = ActiveSheet.Range("A1").Offset(intRow).Address
intRow = intRow + 1
End If
Next obj
End Sub
If you are new to macros..
--Set the Security level to low/medium in (Tools|Macro|Security).
--From workbook launch VBE using short-key Alt+F11.
--From menu 'Insert' a module and paste the below code.
--Get back to Workbook.
--Run macro from Tools|Macro|Run <selected macro()>
If this post helps click Yes
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.