Thread: Check boxes
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Slim Slender[_3_] Slim Slender[_3_] is offline
external usenet poster
 
Posts: 38
Default Check boxes

On Mar 10, 7:31*am, Dave Peterson wrote:
The objects/properties that start with dots like the .checkboxes, .cells and
.parent in this section of code:

* * *With ActiveSheet
* * * * *.CheckBoxes.Delete 'nice for testing
* * * * *For iCtr = FirstRow To LastRow
* * * * * * *If .Cells(iCtr, 2).Value Like "*Pend*" Then
* * * * * * * * *With .Cells(iCtr, CBXCol)
* * * * * * * * * * *With .Parent.CheckBoxes.Add _

mean that each belongs to the object in the previous With statement.

So .checkboxes.delete belongs to the activesheet.
.cells(ictr,2).value belongs to the activesheet.
.cells(ictr,cbxcol) belongs to the activesheet.
.parent.checkboxes.add belongs to the .cells(ictr,cbxcol) which belongs to the
activesheet.

And the .parent of a range is a worksheet. *The .parent of a sheet is the
workbook and the .parent of a workbook is the application (excel).

======
The .width of the cell is measured in points. *But I really don't bother with
the details too much -- I don't care if it's measured in points, pixels, inches,
or even miles!

I usually just experiment to see what looks right. *That's why I added that
.checkboxes.delete line to the code. *It took me a few times to find the correct
offset in my test worksheet.

Remember that you can always add more info to your code to see:
msgbox .cells(ictr,cbxcol).width
may give you a hint.

On 03/09/2011 19:36, Slim Slender wrote:

Thanks Dave,
That did it. The thing about changing the backcolor of the control was
in case nothing else worked and I had to have it flush left in the
cell on top of text but this solves that by moving it to the right. So
Parent refers to the container for the checkbox, the dotted box with
the handles? I suppose that is the same for other controls. What units
is the offset of 35 in? It doesn't seem to be the same unit as the
number you get when you check the column width.


--
Dave Peterson


Thanks again for the help and the additional information.