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

I have the following code to add a checkbox in a cell and center it top to
bottom:

Set chk = cell.Parent.CheckBoxes.Add(cell.Left, cell.Top, 12, cell.Height)
chk as Excel.checkbox
cell as Range

This code works fine in one procedure, but in another one the checkbox is in
the bottom of the cell.

Any Ideas what to do to fix this?
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default checkbox centered in cell

Depending on what the size of the cell is, you could play around with something
like:

Dim chk As CheckBox
Dim cell As Range

Set cell = ActiveSheet.Range("E7")

With cell
Set chk = .Parent.CheckBoxes.Add(Left:=.Left, _
Top:=.Top + (.Height / 4), _
Width:=.Width, _
Height:=.Height / 4)
End With



ranswert wrote:

I have the following code to add a checkbox in a cell and center it top to
bottom:

Set chk = cell.Parent.CheckBoxes.Add(cell.Left, cell.Top, 12, cell.Height)
chk as Excel.checkbox
cell as Range

This code works fine in one procedure, but in another one the checkbox is in
the bottom of the cell.

Any Ideas what to do to fix this?
Thanks


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default checkbox centered in cell

Thanks
I'll give that a try.

Any idea it works in one procedure, but not another?

"Dave Peterson" wrote:

Depending on what the size of the cell is, you could play around with something
like:

Dim chk As CheckBox
Dim cell As Range

Set cell = ActiveSheet.Range("E7")

With cell
Set chk = .Parent.CheckBoxes.Add(Left:=.Left, _
Top:=.Top + (.Height / 4), _
Width:=.Width, _
Height:=.Height / 4)
End With



ranswert wrote:

I have the following code to add a checkbox in a cell and center it top to
bottom:

Set chk = cell.Parent.CheckBoxes.Add(cell.Left, cell.Top, 12, cell.Height)
chk as Excel.checkbox
cell as Range

This code works fine in one procedure, but in another one the checkbox is in
the bottom of the cell.

Any Ideas what to do to fix this?
Thanks


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default checkbox centered in cell

Maybe 12 is too big.



ranswert wrote:

Thanks
I'll give that a try.

Any idea it works in one procedure, but not another?

"Dave Peterson" wrote:

Depending on what the size of the cell is, you could play around with something
like:

Dim chk As CheckBox
Dim cell As Range

Set cell = ActiveSheet.Range("E7")

With cell
Set chk = .Parent.CheckBoxes.Add(Left:=.Left, _
Top:=.Top + (.Height / 4), _
Width:=.Width, _
Height:=.Height / 4)
End With



ranswert wrote:

I have the following code to add a checkbox in a cell and center it top to
bottom:

Set chk = cell.Parent.CheckBoxes.Add(cell.Left, cell.Top, 12, cell.Height)
chk as Excel.checkbox
cell as Range

This code works fine in one procedure, but in another one the checkbox is in
the bottom of the cell.

Any Ideas what to do to fix this?
Thanks


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default checkbox centered in cell

Thanks

"Dave Peterson" wrote:

Maybe 12 is too big.



ranswert wrote:

Thanks
I'll give that a try.

Any idea it works in one procedure, but not another?

"Dave Peterson" wrote:

Depending on what the size of the cell is, you could play around with something
like:

Dim chk As CheckBox
Dim cell As Range

Set cell = ActiveSheet.Range("E7")

With cell
Set chk = .Parent.CheckBoxes.Add(Left:=.Left, _
Top:=.Top + (.Height / 4), _
Width:=.Width, _
Height:=.Height / 4)
End With



ranswert wrote:

I have the following code to add a checkbox in a cell and center it top to
bottom:

Set chk = cell.Parent.CheckBoxes.Add(cell.Left, cell.Top, 12, cell.Height)
chk as Excel.checkbox
cell as Range

This code works fine in one procedure, but in another one the checkbox is in
the bottom of the cell.

Any Ideas what to do to fix this?
Thanks

--

Dave Peterson


--

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
Making the text in a cell with a money format centered Wombat Excel Discussion (Misc queries) 6 April 22nd 23 12:12 AM
Keep chart centered to the page Mary Charts and Charting in Excel 0 October 7th 08 02:05 PM
Watermark centered in PageLay-out Sige Excel Programming 2 October 3rd 05 02:04 PM
Cell alignment centered Simon Fischer Excel Programming 1 July 21st 05 11:01 AM
Centered and right justified using ticks Brent Johnson Excel Discussion (Misc queries) 1 April 13th 05 12:25 AM


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

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"