Private
Sub
CompareCheckboxNames()
Dim
ws
As
Worksheet
Dim
rngSubcategory
As
Range
Dim
shp
As
Excel.Shape
Dim
myText
As
String
On
Error
GoTo
ErrHandler
Set
ws = Worksheets(
"Risk Category Checklist"
)
Set
rngSubcategory = ws.Range(
"G:G"
)
Set
myText = shp.OLEFormat.
Object
.Name.Characters.Text
<em>
With
Worksheets(
"Checklist Structure"
)<strong>
</strong></em>
For
Each
shp
In
.Shapes
If
shp.Type = msoFormControl
Then
If
shp.FormControlType = xlCheckBox
Then
If
rngSubcategory.Value = myText
Then
shp.OLEFormat.
Object
.Value =
True
Else
shp.OLEFormat.
Object
.Value =
False
End
If
Exit
For
End
If
End
If
Next
End
With
Exit
Sub
ErrHandler:
Call
MsgBox(Err.Description, vbCritical,
"Fehler "
& Err.number)
End
Sub