Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA in Excel

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VBA in Excel

Hello Leith,

I tried a similar one but this one do not work. The code is executing
without an error but the captions are not changed.

L_HP_1 is a Label Name
and Camp_CF is a userform

Sub ShowLabels()

Dim I As Integer

For I = 1 To 3
Camp_CF.Controls("L_HP_" & I).Caption = "Akash"
Next I

End Sub
--
Akash Nath
Hewlett Packard India


"Leith Ross" wrote:

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

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



All times are GMT +1. The time now is 03:09 PM.

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

About Us

"It's about Microsoft Excel"