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?
|