Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default Center Checkbox

How do I write a procedure that centers a checkcox vertically in a cell?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Center Comments on Center of Screen Raymond W. Excel Discussion (Misc queries) 5 September 15th 09 04:58 PM
Merge and Center and Center Accross Selection Bojingles03 New Users to Excel 3 March 17th 09 07:05 PM
checkbox on form reset from checkbox on sheet raw[_12_] Excel Programming 1 December 3rd 05 05:08 AM
Center Across Selection Vertically Help. I am trying to center te. msond Excel Discussion (Misc queries) 1 March 29th 05 12:37 PM
Checkbox - Center Horizontally and Vertically _SPCA Excel Programming 0 December 10th 04 10:37 PM


All times are GMT +1. The time now is 07:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"