ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   For each control in sheet (https://www.excelbanter.com/excel-programming/361466-each-control-sheet.html)

Claus[_3_]

For each control in sheet
 
Hi

I would like to adress all controlelements in my worksheet one by one using
the "For Each"- statement, but i can't get it working.

Dim i As Controls
For Each i In Worksheets("Sheet1")
MsgBox i.Name
Next

Hoping for help

Claus



Ivan Raiminius

For each control in sheet
 
Hi Claus,

try something like this:

for each oleobject in worksheets("Sheet1").oleobjects

Regards,
Ivan


Bob Phillips[_14_]

For each control in sheet
 
Dim i As Long

For i = 1 To ActiveSheet.OLEObjects.Count
MsgBox ActiveSheet.OLEObjects(i).Name
Next i


--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"Claus" wrote in message
...
Hi

I would like to adress all controlelements in my worksheet one by one

using
the "For Each"- statement, but i can't get it working.

Dim i As Controls
For Each i In Worksheets("Sheet1")
MsgBox i.Name
Next

Hoping for help

Claus





Claus[_3_]

For each control in sheet
 
Hi Ivan

Thank you, it works ;-)

Claus

"Ivan Raiminius" skrev i en meddelelse
oups.com...
Hi Claus,

try something like this:

for each oleobject in worksheets("Sheet1").oleobjects

Regards,
Ivan





All times are GMT +1. The time now is 09:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com