Dagobah_68
New Member
- Joined
- Jan 9, 2018
- Messages
- 1
Hello everyone, I am working on an excel medical questionnaire using form checkboxes on a worksheet, the questionnaire is devided into several categories, each categorie uses a macro like the following to select a certain option for all items in a given categorie:
Sub SelectAll_Click_Bewusstseinsstörungen()
Dim CB As CheckBox
Dim Nicht_Vorhanden As Range
Dim leichtgradige As Range
Dim mittelgradige As Range
Dim schwergradige As Range
Dim keineAussage As Range
Set Nicht_Vorhanden = Hoja2.Range("E3:E7")
Set leichtgradige = Hoja2.Range("F3:F7")
Set mittelgradige = Hoja2.Range("G3:G7")
Set schwergradige = Hoja2.Range("H3:H7")
Set keineAussage = Hoja2.Range("I3:I7")
For Each CB In Hoja2.CheckBoxes
If Not Intersect(CB.TopLeftCell, Nicht_Vorhanden) Is Nothing Then
CB.Value = Hoja2.CheckBoxes("Check Box 144").Value
End If
If Not Intersect(CB.TopLeftCell, leichtgradige) Is Nothing Then
CB.Value = xlOff
End If
If Not Intersect(CB.TopLeftCell, mittelgradige) Is Nothing Then
CB.Value = xlOff
End If
If Not Intersect(CB.TopLeftCell, schwergradige) Is Nothing Then
CB.Value = xlOff
End If
If Not Intersect(CB.TopLeftCell, keineAussage) Is Nothing Then
CB.Value = xlOff
End If
Next CB
End Sub
Variations of the this Macro are used for each of the other categories. Most Macros work fine, but some only start working properly only after the worksheet has been open for a few minutes, if you click them before, some checkboxes are left unticked. I can't understand why this happens. The worksheet is not that big. Any ideas? Thanks.
Sub SelectAll_Click_Bewusstseinsstörungen()
Dim CB As CheckBox
Dim Nicht_Vorhanden As Range
Dim leichtgradige As Range
Dim mittelgradige As Range
Dim schwergradige As Range
Dim keineAussage As Range
Set Nicht_Vorhanden = Hoja2.Range("E3:E7")
Set leichtgradige = Hoja2.Range("F3:F7")
Set mittelgradige = Hoja2.Range("G3:G7")
Set schwergradige = Hoja2.Range("H3:H7")
Set keineAussage = Hoja2.Range("I3:I7")
For Each CB In Hoja2.CheckBoxes
If Not Intersect(CB.TopLeftCell, Nicht_Vorhanden) Is Nothing Then
CB.Value = Hoja2.CheckBoxes("Check Box 144").Value
End If
If Not Intersect(CB.TopLeftCell, leichtgradige) Is Nothing Then
CB.Value = xlOff
End If
If Not Intersect(CB.TopLeftCell, mittelgradige) Is Nothing Then
CB.Value = xlOff
End If
If Not Intersect(CB.TopLeftCell, schwergradige) Is Nothing Then
CB.Value = xlOff
End If
If Not Intersect(CB.TopLeftCell, keineAussage) Is Nothing Then
CB.Value = xlOff
End If
Next CB
End Sub
Variations of the this Macro are used for each of the other categories. Most Macros work fine, but some only start working properly only after the worksheet has been open for a few minutes, if you click them before, some checkboxes are left unticked. I can't understand why this happens. The worksheet is not that big. Any ideas? Thanks.