View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
DeeJay[_3_] DeeJay[_3_] is offline
external usenet poster
 
Posts: 1
Default Cycling through controls in worksheet


Can someone tell me how to cycle through all the controls in a
worksheet? I tried this:


Code:
--------------------
Private Sub CommandButton1_Click()
Dim ctrl As Control
Dim blad As Worksheet

For Each blad In ActiveWorkbook.Worksheets
Debug.Print blad.Name
For Each ctrl In Controls
Debug.Print ctrl.Name
Next ctrl
Next blad

End Sub
--------------------


But this resulted in an "object required" error. Apparently the
worksheet object does not have a controls collection.


--
DeeJay
------------------------------------------------------------------------
DeeJay's Profile: http://www.excelforum.com/member.php...fo&userid=5420
View this thread: http://www.excelforum.com/showthread...hreadid=397561