What is wrong with this code?
Matt,
This works for me
Sub TestStuff()
Dim MBT As String
Dim fc As OLEObject
Dim t As Integer
If ActiveSheet.Name = "TIME AND LEAVE" Then
For Each fc In ActiveSheet.OLEObjects
If TypeOf fc.Object Is MSForms.CheckBox Then
t = CInt(Mid$(fc.Name, 9))
With ActiveSheet
If .Range("Cell" & t).Value < "" Then
.OLEObjects("CheckBox" & t).Visible = False
Else
.OLEObjects("CheckBox" & t).Visible = True
End If
End With
End If
Next fc
End If
End Sub
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Matt" wrote in message
...
I can't seem to figure out what is wrong w/ this code. I keep getting an
object required error. Thanks.
Sub TestStuff()
Dim MBT As String
Dim fc As OLEObject
Dim t As Integer
If ActiveSheet.Name = "TIME AND LEAVE" Then
For Each fc In OLEObjects
If TypeOf fc.Object Is MSForms.Checkbox Then
t = CInt(Mid$(fc.Name, 9))
With ActiveSheet
For t = 2 To 30
If ActiveSheet.Range("Cell" & t).Value < "" Then
ActiveSheet.OLEObjects("CheckBox" & t).Visible =
False
Else
ActiveSheet.OLEObjects("CheckBox" & t).Visible =
True
End If
Next
End With
End If
Next fc
End If
End Sub
|