working with excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i am using check boxs for yes and no questions,how do i
simplify the size and centering them on a row and column?
 
There are two different checkboxes--one from the controltoolbox toolbar and one
from the forms toolbar.

This code will fill the topleft cell with the checkbox:

Option Explicit
Sub testme1()

Dim OLEObj As OLEObject
Dim myCBX As CheckBox

For Each OLEObj In ActiveSheet.OLEObjects
If TypeOf OLEObj.Object Is MSForms.CheckBox Then
With OLEObj
.Top = .TopLeftCell.Top
.Height = .TopLeftCell.Height
.Width = .TopLeftCell.Width
.Left = .TopLeftCell.Left
End With
End If
Next OLEObj

For Each myCBX In ActiveSheet.CheckBoxes
With myCBX
.Top = .TopLeftCell.Top
.Height = .TopLeftCell.Height
.Width = .TopLeftCell.Width
.Left = .TopLeftCell.Left
End With
Next myCBX

End Sub

The first portion does the controltoolbox toolbar checkboxes--the second portion
does the checkbox from the Forms tool bar.

If you want to resize the checkboxes manually, try holding the Alt-key when
you're adjusting it. (It'll snap to the cell's edge. Shift-move will keep it
in the same plane (vertical/horizontal).

You can use your mouse for minor adjustments if you show the Drawing toolbar.
There's a Draw button on that toolbar that allows you to Nudge and snap. You
can even align a few of them if you select them first.
 
Back
Top