vendredi 27 janvier 2017

VBA - Refer to CheckBox from the cell address

I am looping through few rows and I need to know if the CheckBox in each row is "Checked" or not, but I don't know the name of the CheckBox. The below code is just to illustrate the problem:

Sub Checkboxes()

Dim ws As Worksheet
Set ws = Sheets("Input Data")
Dim Switch As Boolean

For i = 4 To 8
    Switch = ws.Cells(11, i).CheckboxValue
    MsgBox Switch
Next i


End Sub

To create the checkboxes I did the following:

  1. Create a CheckBox
  2. Place it in a cell
  3. Copy below in the same column



Aucun commentaire:

Enregistrer un commentaire