checkbox

  • Thread starter Thread starter ranswert
  • Start date Start date
R

ranswert

I have the following code:

Sub addcheckbox()
Dim a As String
Dim costid As String
Dim cboxname As Integer
Dim cell As Range
Dim chk As Excel.CheckBox
Set cell = ActiveCell
Set chk = cell.Parent.CheckBoxes.Add(cell.Left, cell.Top, 12, cell.Height)
costid = id
'MsgBox ("costid =" & costid)
chk.Height = cell.Height - 1.5
cboxname = ActiveCell.EntireRow.Cells(13)
chk.Characters.Text = none
chk.name = "Checkbox" & costid & cboxname
chk.LinkedCell = ActiveCell.EntireRow.Cells(14).Address
ActiveCell.Select

End Sub

Which had been working fine. I'm not sure what I did, but now the checkbox
is added 3 rows up instead of centering it in the selected cell.

Can you tell me what to do to fix this?
Thanks
 
The checkbox is put in the wrong spot when I have the zoom at less than
100%. It works fine when the zoom is at 100%. Can someone explain to me why
this happens, and how I can fix it?
Thanks
 
Keep track of the zoom
Change the zoom to 100%
do the work
change the zoom back to what it was before

If you turn application.screenupdating off at the beginning, it shouldn't be
noticeable. (And turn application.screenupdating back on at the end.)
 
Is there a way to write a code that will set a variable to the current zoom
setting, so I can reset it after the checkbox is added? or Can I rewrite the
addcheckbox to center it in a cell that wouldn't make a difference on the
zoom?
Thanks
 
You could screw around trying to tweak your code for perfect placement, but I
bet you'll find it easier to change the zoom.

Record a macro when you change the zoom and you'll have the syntax.
 
Thanks I'll try that

Dave Peterson said:
You could screw around trying to tweak your code for perfect placement, but I
bet you'll find it easier to change the zoom.

Record a macro when you change the zoom and you'll have the syntax.
 
Back
Top