Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
centering checkboxes vertical in cell
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
centering checkboxes vertical in cell
wsh is not defined. Try replacing wsh with ActiveSheet.
-- Hope that helps. Vergel Adriano "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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
centering checkboxes vertical in cell
I suspect 'wsh' is not set. For example, insert:
Set wsh = ActiveSheet Hth, Merjet |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cell Text Alignment - Not A Centering Issue | Excel Discussion (Misc queries) | |||
Vertical centering not functioning for print | Excel Discussion (Misc queries) | |||
centering checkboxes | Excel Programming | |||
ability to put checkboxes into a cell (not just onto) | Excel Discussion (Misc queries) | |||
Centering a Shape over a given cell when resizing | Excel Programming |