centering checkboxes vertical in cell
You didn't declare wsh or tell excel what wsh was.
But since you know the cell that the checkbox goes in, then you can use:
Set chk = cell.parent.CheckBoxes.Add(cell.left + 0.3, ....
The parent of the cell is the worksheet that it's located on.
ranswert wrote:
I used this code to center a checkbox vertically in a cell and I got a "run
time error object required message". This is the code I entered:
Sub cbox()
Dim cell As Range
Dim chk As Excel.CheckBox
Set cell = ActiveCell
Set chk = wsh.CheckBoxes.Add(cell.Left + 0.3 * cell.Width, cell.Top,
cell.Width, cell.Height)
chk.Height = cell.Height - 1.5
End Sub
--
Dave Peterson
|