D
Dr. Schwartz
In Excel 2003 I have 12 control checkboxes (only 2 below in the code) in my
sheet. Depending on the value of the individual checkbox a piece of code
should run.
Public BoxId As Integer
Private Sub CheckBox1_Click()
BoxId = 1
UpdateDataLine
End Sub
Private Sub CheckBox2_Click()
BoxId = 2
UpdateDataLine
End Sub
Sub UpdateDataLine()
'BoxId = BoxId + 4145
Dim cbx As shape, cbx_val
For Each cbx In ActiveSheet.Shapes
If cbx.ID = BoxId + 4145 Then
If cbx.Value = True Then 'this one is causing me problems
ThisWorkbook.Worksheets("mysheet").Range(Cells(BoxId + 2,
1), Cells(BoxId + 2, 3)).Value = _
ThisWorkbook.Worksheets("mysheet").Range(Cells(BoxId + 2,
15), Cells(BoxId + 2, 17)).Value
End If
End If
Next
End Sub
My problem is that I can't find a way to determine the value of the given
checkbox. when i type cbx. I don't get the Value option in the dropdown list
that appear so I'm sure I'm doing something fundamentally wrong.
Is my code "the long way" to perform a simple thing or how can I make it work?
Anyone?
Thanks
The Doctor
sheet. Depending on the value of the individual checkbox a piece of code
should run.
Public BoxId As Integer
Private Sub CheckBox1_Click()
BoxId = 1
UpdateDataLine
End Sub
Private Sub CheckBox2_Click()
BoxId = 2
UpdateDataLine
End Sub
Sub UpdateDataLine()
'BoxId = BoxId + 4145
Dim cbx As shape, cbx_val
For Each cbx In ActiveSheet.Shapes
If cbx.ID = BoxId + 4145 Then
If cbx.Value = True Then 'this one is causing me problems
ThisWorkbook.Worksheets("mysheet").Range(Cells(BoxId + 2,
1), Cells(BoxId + 2, 3)).Value = _
ThisWorkbook.Worksheets("mysheet").Range(Cells(BoxId + 2,
15), Cells(BoxId + 2, 17)).Value
End If
End If
Next
End Sub
My problem is that I can't find a way to determine the value of the given
checkbox. when i type cbx. I don't get the Value option in the dropdown list
that appear so I'm sure I'm doing something fundamentally wrong.
Is my code "the long way" to perform a simple thing or how can I make it work?
Anyone?
Thanks
The Doctor