![]() |
THIS IS A BUG
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... |
THIS IS A BUG
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 "SamB" wrote in message ... 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... |
All times are GMT +1. The time now is 09:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com