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


I am trying to insert checkboxes into a specific cell range of cells. I
have a loop to process each cell in turn and then add the cb.


Code:
--------------------

LeftPosition = ActiveCell.Left
TopPosition = ActiveCell.Top
ActiveSheet.CheckBoxes.Add(LeftPosition, TopPosition, 25, 17.25).Select
Selection.Characters.Text = ""
With Selection
.Value = xlOff
.LinkedCell = CheckBoxLink
.Display3DShading = False
End With

--------------------


The loop processes the cells and adds the checkboxes successfully (1000
rows) but the further down the page it gets the checkboxes become
unaligned to the cell that it should be inserted into.

I thought that the checkbox could be inserted into the cell using the
top and left parameters of the cell, but I'm getting very frustrated
with this now !

Any suggestions welcome.Thanks....


--
shadespool
------------------------------------------------------------------------
shadespool's Profile: http://www.excelforum.com/member.php...o&userid=34537
View this thread: http://www.excelforum.com/showthread...hreadid=542970

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default adding checkboxes

Maybe something like this:

Sub AddBoxes()
Dim cell As Range
Dim cBox As CheckBox
For Each cell In Range("A2:A100")

Set cBox = ActiveSheet.CheckBoxes.Add( _
cell.Left, _
cell.Top, 25, 17.25)
cell.EntireRow.RowHeight = 17.25
cBox.Caption = ""
cBox.Value = xlOff
cBox.LinkedCell = cell.Address(external:=True)
cBox.Display3DShading = False
Next
End Sub

--
Regards,
Tom Ogilvy


"shadespool" wrote:


I am trying to insert checkboxes into a specific cell range of cells. I
have a loop to process each cell in turn and then add the cb.


Code:
--------------------

LeftPosition = ActiveCell.Left
TopPosition = ActiveCell.Top
ActiveSheet.CheckBoxes.Add(LeftPosition, TopPosition, 25, 17.25).Select
Selection.Characters.Text = ""
With Selection
.Value = xlOff
.LinkedCell = CheckBoxLink
.Display3DShading = False
End With

--------------------


The loop processes the cells and adds the checkboxes successfully (1000
rows) but the further down the page it gets the checkboxes become
unaligned to the cell that it should be inserted into.

I thought that the checkbox could be inserted into the cell using the
top and left parameters of the cell, but I'm getting very frustrated
with this now !

Any suggestions welcome.Thanks....


--
shadespool
------------------------------------------------------------------------
shadespool's Profile: http://www.excelforum.com/member.php...o&userid=34537
View this thread: http://www.excelforum.com/showthread...hreadid=542970


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default adding checkboxes


Tom,

many thanks,
There seems to be a relation with the minimum size of the checkbo
(17.25). The mising link was to set the row height to the same heigh
as the checkbox.
:

--
shadespoo
-----------------------------------------------------------------------
shadespool's Profile: http://www.excelforum.com/member.php...fo&userid=3453
View this thread: http://www.excelforum.com/showthread.php?threadid=54297

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
Adding multiple checkboxes timmeah4 Excel Discussion (Misc queries) 7 December 6th 06 02:48 PM
Help:Programmatically Adding Checkboxes with Captions [email protected] Excel Programming 2 April 19th 06 08:09 PM
Adding checkboxes via code to a workheet Stef Excel Programming 0 February 1st 05 02:51 PM
Adding Checkboxes Programmatically Mark D'Agosta Excel Programming 1 October 8th 03 03:20 AM
Adding Checkboxes Wes[_3_] Excel Programming 2 July 31st 03 11:27 PM


All times are GMT +1. The time now is 11:20 AM.

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

About Us

"It's about Microsoft Excel"