Sub
CompareCheckboxNames()
Dim
ws
As
Worksheet
Dim
SrchRng
Dim
shp
As
Object
Dim
myText
As
String
Dim
c
As
Range
On
Error
GoTo
ErrHandler
Set
ws = Worksheets(
"Risk Category Checklist"
)
Set
SrchRng = ws.Range(
"G:G"
)
With
Worksheets(
"Checklist Structure"
)
For
Each
shp
In
.Shapes
If
shp.Type = msoFormControl
Then
If
shp.FormControlType = xlCheckBox
Then
myText = shp.OLEFormat.
Object
.Name
Set
c = SrchRng.Find(myText, LookIn:=xlValues)
If
Not
c
Is
Nothing
Then
shp.OLEFormat.
Object
.Value =
True
Else
shp.OLEFormat.
Object
.Value =
False
End
If
End
If
End
If
Next
shp
End
With
Exit
Sub
ErrHandler:
Call
MsgBox(Err.Description, vbCritical,
"Fehler "
& Err.number)
End
Sub