Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default For...Each loop problem

Try this

You obviously don't need the msgbox line that's judt to demonstrate it's
wotking

Sub marine()
Dim ws As Worksheet
Dim obj As OLEObject
Set ws = Sheets("Sheet1")
For Each obj In ws.OLEObjects
If TypeName(obj.Object) = "ListBox" Then
MsgBox TypeName(obj.Object)
'do something
End If
Next obj
End Sub

Mike

"synapse5150" wrote:


I am trying to loop through all the listboxes I have in an Excel
worksheet (NOT userform), and I'm having problems. If this was a
userform, I would use a for each loop (like 'for each control in
userform.controls') but I'm not sure how to translate this collection to
a worksheet. Any ideas?


--
synapse5150
------------------------------------------------------------------------
synapse5150's Profile: http://www.thecodecage.com/forumz/member.php?userid=115
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=58770


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
Problem with For Each loop WLMPilot Excel Programming 8 November 17th 08 12:46 AM
Loop Within a Loop Problem [email protected] Excel Programming 3 December 5th 07 01:23 PM
for next loop problem Joanne Excel Programming 3 August 13th 07 01:30 PM
Problem adding charts using Do-Loop Until loop Chris Bromley[_2_] Excel Programming 2 May 23rd 05 01:31 PM
For...Each Loop Problem SuperJas Excel Programming 4 April 2nd 04 05:01 AM


All times are GMT +1. The time now is 01:43 PM.

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

About Us

"It's about Microsoft Excel"