bartsimpsong
New Member
- Joined
- Jun 24, 2014
- Messages
- 14
Hello, I have been working on this small project and I it works to create checkboxes and check what boxes are checked. However, at the end of checking which boxes are checked there is a pop up error message saying Run-Time error '1004':
Unable to get the CheckBoxes property of the Worksheet class. These are the lines of code, can anybody see the error? Thank you very much
Sub IsBoxChecked()
Dim titles(200) As String
Dim wks As Worksheet
Dim nTitles As Integer
Dim totalCheckBoxes As Integer
totalCheckBoxes = 0
Set wks = ActiveWorkbook.Worksheets("Sheet1")
For i = 1 To 199
If Trim(wks.Cells(4, i).Value) = "" Then
nTitles = i - 1
Exit For
End If
titles(i - 1) = wks.Cells(4, i).Value
totalCheckBoxes = totalCheckBoxes + 1
Next
j = 1
For j = 1 To totalCheckBoxes
If ActiveSheet.checkBoxes(titles(j)).Value = 1 Then
MsgBox titles(j) & " CheckBox Is Checked"
Else
MsgBox titles(j) & " CheckBox is UnChecked"
End If
Next
End Sub
Unable to get the CheckBoxes property of the Worksheet class. These are the lines of code, can anybody see the error? Thank you very much
Sub IsBoxChecked()
Dim titles(200) As String
Dim wks As Worksheet
Dim nTitles As Integer
Dim totalCheckBoxes As Integer
totalCheckBoxes = 0
Set wks = ActiveWorkbook.Worksheets("Sheet1")
For i = 1 To 199
If Trim(wks.Cells(4, i).Value) = "" Then
nTitles = i - 1
Exit For
End If
titles(i - 1) = wks.Cells(4, i).Value
totalCheckBoxes = totalCheckBoxes + 1
Next
j = 1
For j = 1 To totalCheckBoxes
If ActiveSheet.checkBoxes(titles(j)).Value = 1 Then
MsgBox titles(j) & " CheckBox Is Checked"
Else
MsgBox titles(j) & " CheckBox is UnChecked"
End If
Next
End Sub