View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
TFriis TFriis is offline
external usenet poster
 
Posts: 22
Default linkedcell with togglebuttons problem

I used to use checkboxes, but a coworker of mine told me about
togglebuttons - so I'm wondering how I change the following code to
work with togglebuttons instead of checkboxes:

_____________________________

Sub chkb()

Dim RngChckBox

Set RngChckBox = Range("A1")
ActiveSheet.CheckBoxes.Add(RngChckBox.Left, RngChckBox.Top,
RngChckBox.Width, RngChckBox.Height).Select
With Selection
.LinkedCell = "'Sheet2'!" & RngChckBox.Address
.Characters.Text = "Test"
.OnAction = "msg"
End With

End Sub

Sub msg()

MsgBox "Test works"

End Sub

_____________________________

I have due to a lot of searching found out how to create togglebuttons
like this:

_____________________________

Sub tgbtn()

Dim RngTgnBtn

Set RngLink = Range("F2")
Set RngTgnBtn = Range("E8:F9")
ActiveSheet.OLEObjects.Add("Forms.ToggleButton.1", , , , , , ,
RngTgnBtn.Left, RngTgnBtn.Top, RngTgnBtn.Width,
RngTgnBtn.Height).Select
'With Selection
'.LinkedCell = RngLink.Address
'.Characters.Text = "Test"
'.OnAction = "msg"
'End With

End Sub

_____________________________

But I have no idea how I change the linkedcell :(

Any help is appreciated!