Thread: Form Control
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Form Control

I don't think so.

But you could just reassign the linked cells.

I used column A of the same row that held the checkbox.

Option Explicit
Sub testme()

Dim myCB As CheckBox

With Worksheets("Sheet1")
For Each myCB In .CheckBoxes
myCB.LinkedCell _
= .Cells(myCB.TopLeftCell.Row, "A").Address(external:=True)
Next myCB
End With

End Sub

And I used checkboxes from the Forms toolbar.

And if they were from the control toolbox toolbar:

Option Explicit
Sub testme2()

Dim OLEObj As OLEObject

With Worksheets("Sheet1")
For Each OLEObj In .OLEObjects
If TypeOf OLEObj.Object Is msforms.CheckBox Then
OLEObj.LinkedCell _
= .Cells(OLEObj.TopLeftCell.Row, "A") _
.Address(external:=True)
End If
Next OLEObj
End With

End Sub




Tammy wrote:

I am trying to use the checkbox form control in an Excel
spreadsheet where the checkbox value (true/false) is
linked to a cell. I can get the form control to work just
fine, however when I copy and paste the control to another
field, the cell link does not automatically change. I
have tried removing the $ from the cell link reference,
but the cell does not change. Since I have about 200 rows
which need this checkbox control, it would not be
efficient for me to manually change the cell reference in
each control property. Is there someway I can get the
cell reference to change when I copy/paste it?

Thanks in advance for any info you can provide.


--

Dave Peterson