How to link the checkbox into its cell automatically in Excel

preview_player
Показать описание
Steps to Create a VBA Macro:
Open the VBA Editor:

Press Alt + F11 to open the Visual Basic for Applications (VBA) editor.
Insert a Module:

In the VBA editor, go to "Insert" then "Module." This will add a new module where you can write the code.
Write the VBA Code: Paste the following VBA code in the module:

Sub LinkCheckboxes()
Dim ws As Worksheet
Dim chk As CheckBox
Dim cell As Range

Set ws = ActiveSheet ' Set to the active worksheet or specify the worksheet name

' Loop through all checkboxes in the worksheet
For Each chk In ws.CheckBoxes
' Link each checkbox to its corresponding cell
Set cell = chk.TopLeftCell
chk.LinkedCell = cell.Address
Next chk
End Sub

Close the VBA editor.
Press Alt + F8, select the LinkCheckboxes macro, and click "Run."
Рекомендации по теме
Комментарии
Автор

رائع مهندس تركي و ياليت تستمرفي فيدوهات شرح عن الاكسل و تحليل البيانات

MS-sdbz