T
TFriis
Hi experts.
I have a problem with a checkbox' linkedcell. - the following code
works as a charm - but if I want to change the reference to another
sheet, it doesn't work (sub test2)
'------------------- Code that works ---------------
Sub test()
Dim rng As Range
Dim myRange As Range
'On Error Resume Next
Set myRange = Range("A10")
Set rng = Range("A11")
ActiveSheet.CheckBoxes.Add(myRange.Left, myRange.Top,
myRange.Width, myRange.Height).Select
With Selection
.LinkedCell = rng(1, 1).Address
.Characters.Text = "Test"
End With
End Sub
'------------------- Code that does NOT works ---------------
Sub test2()
Dim rng As Range
Dim myRange As Range
'On Error Resume Next
Set myRange = Range("A10")
Set rng = Range("A11")
ActiveSheet.CheckBoxes.Add(myRange.Left, myRange.Top,
myRange.Width, myRange.Height).Select
With Selection
.LinkedCell = Sheets("Sheet1").rng(1, 1).Address
.Characters.Text = "Test"
End With
End Sub
Can anybody help me?
I have a problem with a checkbox' linkedcell. - the following code
works as a charm - but if I want to change the reference to another
sheet, it doesn't work (sub test2)
'------------------- Code that works ---------------
Sub test()
Dim rng As Range
Dim myRange As Range
'On Error Resume Next
Set myRange = Range("A10")
Set rng = Range("A11")
ActiveSheet.CheckBoxes.Add(myRange.Left, myRange.Top,
myRange.Width, myRange.Height).Select
With Selection
.LinkedCell = rng(1, 1).Address
.Characters.Text = "Test"
End With
End Sub
'------------------- Code that does NOT works ---------------
Sub test2()
Dim rng As Range
Dim myRange As Range
'On Error Resume Next
Set myRange = Range("A10")
Set rng = Range("A11")
ActiveSheet.CheckBoxes.Add(myRange.Left, myRange.Top,
myRange.Width, myRange.Height).Select
With Selection
.LinkedCell = Sheets("Sheet1").rng(1, 1).Address
.Characters.Text = "Test"
End With
End Sub
Can anybody help me?