What is the mistake in this cod?

PARSA

New Member
Joined
Jan 30, 2014
Messages
44
HELLO,
THIS COD IS NOT WORK! WHAT?
Code:
Dim C As Integer
For C = 1 To 2
LabelC.Enabled = True
Next
I HAVE 2 LABEL THAT HAVE THIS PROPERTIES: (Enabled = False)
AND I WANT TO CHANGE THIS PROPERTIES TO "TRUE" WITH THIS COD, BUT THIS COD NOT WORK!
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
19,343
Office Version
  1. 2021
Platform
  1. Windows
Try this:
Code:
Dim C As Integer
For C = 1 To 2
LabelC.Enabled = True
Next [B][SIZE=2][COLOR=#b22222]C[/COLOR][/SIZE][/B]
 
Upvote 0

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
38,150
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
HELLO,
THIS COD IS NOT WORK! WHAT?
Code:
Dim C As Integer
For C = 1 To 2
LabelC.Enabled = True
Next
I HAVE 2 LABEL THAT HAVE THIS PROPERTIES: (Enabled = False)
AND I WANT TO CHANGE THIS PROPERTIES TO "TRUE" WITH THIS COD, BUT THIS COD NOT WORK!
1) Where is the label located at... on a worksheet or in a UseForm?

2) If on a worksheet, then what kind of label is it... a Forms label or an ActiveX label?
 
Upvote 0

PARSA

New Member
Joined
Jan 30, 2014
Messages
44
1) Where is the label located at... on a worksheet or in a UseForm?

2) If on a worksheet, then what kind of label is it... a Forms label or an ActiveX label?
LABEL IS IN A FORM AND I WIRTE THIS COD IN "CommandButton1_Click"
 
Upvote 0

PARSA

New Member
Joined
Jan 30, 2014
Messages
44
Try your code this way...
Code:
Dim C As Integer
For C = 1 To 2
  Me.Controls("Label" & C).Enabled = True
Next
THANKS
51.gif
 
Upvote 0

Forum statistics

Threads
1,191,055
Messages
5,984,391
Members
439,883
Latest member
onions44

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top