Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default What is wrong with this code?

I got it figured out. Thanks, Bob.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is wrong with this code? Ayo Excel Discussion (Misc queries) 14 June 10th 08 03:09 AM
What is wrong with this code? jlclyde Excel Discussion (Misc queries) 5 January 9th 08 05:12 PM
Can someone tell me what is wrong with this code? Ant Excel Discussion (Misc queries) 8 November 14th 05 02:53 PM
What's wrong with my code ? christophe meresse Excel Worksheet Functions 3 August 2nd 05 05:09 PM
What's wrong with this bit of code Mervyn Thomas Excel Programming 7 January 22nd 04 03:56 PM


All times are GMT +1. The time now is 07:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"