dimanche 28 mars 2021

Excel VBA generated checkboxes not aligning with cells

I would like to create a column of 100 checkboxes to select rows.
I can create the checkboxes but as they go further down the sheet the checkboxes slowly diverge from the desired rows. Checkbox labeled for row 101 - chkbox101 ends up in row 102. checkbox labeled chkbox101 in row 102

Dim cBox As CheckBox

Dim cell As Range

For Each cell In Range("a2:a101")
  Set cBox = ActiveSheet.CheckBoxes.Add(cell.Left, cell.Top , cell.Width, cell.Height)
     
  cBox.Text = "CHKBX " & cell.Row
                
       
Next cell



Aucun commentaire:

Enregistrer un commentaire