ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Asigning a variable to the Name of a Label in a UserForm (https://www.excelbanter.com/excel-programming/346659-asigning-variable-name-label-userform.html)

Chris Gorham

Asigning a variable to the Name of a Label in a UserForm
 
Hi,

I've developed a simple "slidey bar" made up of a series of coloured Labels
in a UserForm. The "slidey bar" shows the progress of some VBA code as it
performs an operation on a workbook.

Each element of the "slidey bar" is called Bar1, Bar2 etc and each is made
visible as the code progresses. From the point of view of neatness it would
be better to have something like "Bar" & var.visible = true and increment var
after each operation. However at the moment I have Bar 1, Bar2 through to
Bar30.visible = true which looks awful especially when I set each one of them
to invisible at the beginning of the code.

Suggestions...Chris



Bob Umlas

Asigning a variable to the Name of a Label in a UserForm
 
Try something like
me.Controls("Bar" & var).Visible
Bob Umlas
Excel MVP
"Chris Gorham" wrote in message
...
Hi,

I've developed a simple "slidey bar" made up of a series of coloured
Labels
in a UserForm. The "slidey bar" shows the progress of some VBA code as it
performs an operation on a workbook.

Each element of the "slidey bar" is called Bar1, Bar2 etc and each is made
visible as the code progresses. From the point of view of neatness it
would
be better to have something like "Bar" & var.visible = true and increment
var
after each operation. However at the moment I have Bar 1, Bar2 through to
Bar30.visible = true which looks awful especially when I set each one of
them
to invisible at the beginning of the code.

Suggestions...Chris






All times are GMT +1. The time now is 06:59 AM.

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