Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi folks
I have a database with 12 sets of 10 questions. I therefore have 10 labels on my userform. (One for each question in the set) When the user clicks on the NEXT button, I want to change the value of label to the new question set. I have tried the following. For MyCount = 1 To 10 MyRange = "B" & MyCount Label(MyCount) = Sheets("Questions").Range(MyRange) Next MyCount The problem is that "Label(MyCount)" does not work. Does anybody know how reference the labels dynamically. Thanks ![]() --- Message posted from http://www.ExcelForum.com/ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
if the labels have names like label1, label2 then
For MyCount = 1 To 10 MyRange = "B" & MyCount Userform1.Controls("Label" &MyCount).Caption = Sheets("Questions").Range(MyRange) Next MyCount -- Regards, Tom Ogilvy "liddlem " wrote in message ... Hi folks I have a database with 12 sets of 10 questions. I therefore have 10 labels on my userform. (One for each question in the set) When the user clicks on the NEXT button, I want to change the value of label to the new question set. I have tried the following. For MyCount = 1 To 10 MyRange = "B" & MyCount Label(MyCount) = Sheets("Questions").Range(MyRange) Next MyCount The problem is that "Label(MyCount)" does not work. Does anybody know how reference the labels dynamically. Thanks ![]() --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You'll have to use
Controls("Label" & MyCount) = Sheets("Questions").Range(MyRange) liddlem wrote in message ... Hi folks I have a database with 12 sets of 10 questions. I therefore have 10 labels on my userform. (One for each question in the set) When the user clicks on the NEXT button, I want to change the value of label to the new question set. I have tried the following. For MyCount = 1 To 10 MyRange = "B" & MyCount Label(MyCount) = Sheets("Questions").Range(MyRange) Next MyCount The problem is that "Label(MyCount)" does not work. Does anybody know how reference the labels dynamically. Thanks ![]() --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007 text labels in category axis - missing labels | Charts and Charting in Excel | |||
referencing a different tab by referencing a list in the current s | Excel Worksheet Functions | |||
Referencing a cell dynamically | Excel Worksheet Functions | |||
Return a value by referencing row and column labels? | Excel Discussion (Misc queries) | |||
add data labels in charts with tools (dynamically) | Charts and Charting in Excel |