THIS IS A BUG

S

SamB

Object positioning is set to "Move but don't size with cells"

Uset this code to add checkboxes to a 25Rx4C selection of cells:

Sub SAM()
Dim c As Range
Dim lb As Shape

For Each c In Application.Selection
With ActiveWorkbook.ActiveSheet
Set lb = .Shapes.AddFormControl(xlCheckBox, c.Left + (c.Width / 3),
c.Top, 0, 12.75)
lb.TextFrame.Characters.Text = ""

lb.ControlFormat.LinkedCell = c.Address

End With
Next
End Sub

Try to insert single entire rows in the set of checkboxes. Randomly, a row
of check boxes will move with the inserted row. Next randomly, the checkboxes
will not move with the inserted row. This ain't right...
 
P

Peter T

Checkboxes have minimum HxW dimensions, in my system 16.5 x 23.25.

You are trying to set the height to 12.75, presumably your row height. Put a
break in your code and in the locals window look at the height of the lb
shape.

When you come to insert rows part of the checkbox will be in the row below
and possibly its Top may actually be slightly above the row you thought it
was.

Together with the fact the option Size with cells is not available it's not
surprising unpredictable things occur when you insert rows. It might be an
idea to set your row height to at least 16.5, certainly before inserting
rows and perhaps also before adding your checkboxes.

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top