Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default centering checkboxes vertical in cell

I suspect 'wsh' is not set. For example, insert:
Set wsh = ActiveSheet

Hth,
Merjet


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
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
Cell Text Alignment - Not A Centering Issue Minitman Excel Discussion (Misc queries) 4 July 14th 08 08:42 AM
Vertical centering not functioning for print Tony Paskitti Excel Discussion (Misc queries) 1 June 5th 08 01:43 AM
centering checkboxes Elan Arad Excel Programming 1 March 11th 06 05:50 PM
ability to put checkboxes into a cell (not just onto) jayjay17 Excel Discussion (Misc queries) 3 July 19th 05 09:01 PM
Centering a Shape over a given cell when resizing Linking to specific cells in pivot table Excel Programming 6 July 14th 05 12:30 AM


All times are GMT +1. The time now is 12:36 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"