PC Review


Reply
Thread Tools Rate Thread

Center Checkbox

 
 
ranswert
Guest
Posts: n/a
 
      28th Dec 2007
How do I write a procedure that centers a checkcox vertically in a cell?
 
Reply With Quote
 
 
 
 
sebastienm
Guest
Posts: n/a
 
      28th Dec 2007
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 With Quote
 
ranswert
Guest
Posts: n/a
 
      2nd Jan 2008
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 With Quote
 
sebastienm
Guest
Posts: n/a
 
      2nd Jan 2008
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 With Quote
 
ranswert
Guest
Posts: n/a
 
      3rd Jan 2008
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access 2007: How to center checkbox under label? Jimbo213 Microsoft Access Reports 2 13th May 2009 04:07 PM
Welcome Center - can't get rid of it (checkbox is missing!) William Dowell Windows Vista Installation 3 25th Jul 2008 06:17 AM
Welcome Center - can't get rid of it (checkbox is missing!) William Dowell Windows Vista General Discussion 2 23rd Jul 2008 06:17 PM
Access 2007 center checkbox on report? Elizabeth Swoope Microsoft Access Reports 1 4th Dec 2007 08:46 PM
Checkbox - Center Horizontally and Vertically _SPCA Microsoft Excel Programming 0 10th Dec 2004 10:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:10 PM.