Populating 30 userform labels from 10 rows, 3 columns data

jdesi

New Member
Joined
Apr 18, 2002
Messages
13
In sheet1 I'm keeping a list of values that I want to display in a userform, with 10 "rows" of data. I have the userform labels set up so that
label11 corresponds to what's in A1 aka cells(1,1)
label12 corresponds to what's in B1 aka cells(1,2)
label13 corresponds to what's in C1 aka cells(1,3)
label21 corresponds to what's in A2 aka cells(2,1)
etc
through label103... for C10 / cells (10,3)

I know how to assign values from sheet1 to userform1.label1 by brute force / having trouble figuring out how to reference the labels programmatically, e.g. the nonsensical syntax below:

for R = 1 to 10
for C = 1 to 3
UserForm1.LabelRC = Cells(R,C)
next C
next R

any help with how to refer to the userform labels would be greatly appreciated
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

chiello

Well-known Member
Joined
Jan 18, 2005
Messages
848
Re: Populating 30 userform labels from 10 rows, 3 columns da

jdesi, the following code should work for you...

For R = 1 To 10
For C = 1 To 3
UserForm1.Controls("Label" & R & C) = Cells(R, C)
Next C
Next R


Ciao

(y)
 

jdesi

New Member
Joined
Apr 18, 2002
Messages
13
Re: Populating 30 userform labels from 10 rows, 3 columns da

grazie. chiello
 

Forum statistics

Threads
1,181,623
Messages
5,931,016
Members
436,771
Latest member
kwicol

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