Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Center Checkbox
How do I write a procedure that centers a checkcox vertically in a cell?
|
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Center Checkbox
Hi,
Try something like: 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 -- Regards, Sébastien <http://www.ondemandanalysis.com <http://www.ready-reports.com "ranswert" wrote: How do I write a procedure that centers a checkcox vertically in a cell? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Center Checkbox
I copied the code that you suggested 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 Thanks "sebastienm" wrote: Hi, Try something like: 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 -- Regards, Sébastien <http://www.ondemandanalysis.com <http://www.ready-reports.com "ranswert" wrote: How do I write a procedure that centers a checkcox vertically in a cell? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Center Checkbox
You're right, wsh is not defined. So, instead of
Set chk = wsh.CheckBoxes.... use Set chk = cell.Parent.CheckBoxes.... -- Regards, Sébastien <http://www.ondemandanalysis.com <http://www.ready-reports.com "ranswert" wrote: I copied the code that you suggested 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 Thanks "sebastienm" wrote: Hi, Try something like: 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 -- Regards, Sébastien <http://www.ondemandanalysis.com <http://www.ready-reports.com "ranswert" wrote: How do I write a procedure that centers a checkcox vertically in a cell? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Center Checkbox
Works great
Thank you "sebastienm" wrote: You're right, wsh is not defined. So, instead of Set chk = wsh.CheckBoxes.... use Set chk = cell.Parent.CheckBoxes.... -- Regards, Sébastien <http://www.ondemandanalysis.com <http://www.ready-reports.com "ranswert" wrote: I copied the code that you suggested 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 Thanks "sebastienm" wrote: Hi, Try something like: 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 -- Regards, Sébastien <http://www.ondemandanalysis.com <http://www.ready-reports.com "ranswert" wrote: How do I write a procedure that centers a checkcox vertically in a cell? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Center Comments on Center of Screen | Excel Discussion (Misc queries) | |||
Merge and Center and Center Accross Selection | New Users to Excel | |||
checkbox on form reset from checkbox on sheet | Excel Programming | |||
Center Across Selection Vertically Help. I am trying to center te. | Excel Discussion (Misc queries) | |||
Checkbox - Center Horizontally and Vertically | Excel Programming |