Thread: VBA in Excel
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_2_] Leith Ross[_2_] is offline
external usenet poster
 
Posts: 128
Default VBA in Excel

On Jun 8, 6:27 pm, Dunc_w wrote:
I am a new VBA programmer. I have code similiar to:

label1.visible = true
label2.visible = true
label3.visible = true

Clearly this is suitable for a for loop. I an having difficulties figuring
out the code for such an action. Any suggestions?


Hello Dunc_w,

Provided these labels are on a UserForm and the numbers are sequential
then this will work...
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sub ShowLabels()

Dim I

For I = 1 To 3
UserForm1.Controls("Label" & I).Visible = True
Next I

End Sub
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sincerely,
Leith Ross