View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Cycling through controls in worksheet

Hi DeeJay

You can use the Shapes collection

I have info about deleting controls here, but you can see how you must loop there
http://www.rondebruin.nl/controlsobjectsworksheet.htm



--
Regards Ron de Bruin
http://www.rondebruin.nl


"DeeJay" wrote in message
...

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