I am relatively new to Excel VBA. I have found the following code online to add multiple check boxes in excel in a particular worksheet (Let's call it Sheet 1):
Sub AddCheckBoxes()
On Error Resume Next
Dim c As Range, myRange As Range
Set myRange = Selection
For Each c In myRange.Cells
ActiveSheet.CheckBoxes.Add(c.Left, c.Top, c.Width, c.Height).Select
With Selection
.LinkedCell = c.Address
.Characters.Text = ""
.Name = c.Address
End With
Next
myRange.Select
End Sub
As seen above, each check box is linked to the cell it is located in. What I am trying to do is find out a way to link the result of the check box (True, False) to another sheet (let's call it worksheet 2) in the same excel file. For example, if I were to click a checkbox on row W9 on sheet 1, it should say True on W9 on sheet 2. Is there a way to tweak the above code to make that work?
Thanks for your help in advance
Aucun commentaire:
Enregistrer un commentaire