ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Looping through control (https://www.excelbanter.com/excel-programming/336320-looping-through-control.html)

Libby

Looping through control
 
Hi,

I think I may have asked this before, but I can't find the post.

I have a userform with a mixture of control on it. I want to set the visible
property of all the images to false

How do I loop through the controls and make only the images invisible? My
current
code makes all the controls invisible.

Many thanks in advance.
Libby x

Bob Phillips[_6_]

Looping through control
 
Libby,

Here is some code that will work from within the userform module

Dim ctl As Control

For Each ctl In Me.Controls
If TypeOf ctl Is Image Then
ctl.Visible = True
Else
ctl.Visible = False
End If
Next ctl



--

HTH

RP
(remove nothere from the email address if mailing direct)


"Libby" wrote in message
...
Hi,

I think I may have asked this before, but I can't find the post.

I have a userform with a mixture of control on it. I want to set the

visible
property of all the images to false

How do I loop through the controls and make only the images invisible? My
current
code makes all the controls invisible.

Many thanks in advance.
Libby x





All times are GMT +1. The time now is 12:27 PM.

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