Sub CreateCheckboxesWithCellReferences()
Dim ws As Worksheet
Dim rng As Range
Dim cb As CheckBox
Dim cell As Range
' VBA Code By Excelmind
' Set the worksheet where you want to add checkboxes
Set ws = ThisWorkbook.Sheets("Sheet1")
' Select the range where you want to add checkboxes
Set rng = Application.InputBox("Select a range", Type:=8)
' Loop through each cell in the selected range
For Each cell In rng
' Create a checkbox in each cell
Set cb = ws.CheckBoxes.Add(cell.Left, cell.Top, cell.Width, cell.Height)
' Set the linked cell for the checkbox
cb.LinkedCell = cell.Address
' Adjust the checkbox appearance
cb.Caption = ""
cb.Value = xlOff
Next cell
End Sub
Thank you for sharing such a valuable topic. This Content proved to be extremely useful and efficient for me. Are you interested in taking an Excel VBA course? Excel VBA course Visual Basic for Applications(VBA) is the language in which Excel is written and can be utilized to extend the ability of your own Excel program.
ReplyDelete