Excel range to a form's textboxes how-to

Brian.Crawford

Board Regular
Joined
Oct 3, 2007
Messages
136
I have a number of separate (named) ranges of Excel columns (annual periods 1-12) that I wish to display on a user form in a series of textboxes, 1-12 across with separate rows for category (budget, actual, etc., each has separate named range). What is the simplest way to make the transfer. I was considering moving the cells to an array for each category and then from an array to the textboxes. But I am not sure if that the best way and even if it is I am not sure of the most efficient or any way to get the data from the array to the textboxes in a simple manner.
Any suggestions please
thanks in advance
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Could do something like this in a Form event/button
(Assumes Textboxes are 0-11 for budgeted, 12-24, actual, etc. )

Code:
Dim C As Range
CtrlIdx = 0
For Each C In Range("budget")
    'Me.Controls(CtrlIdx).BackColor = RGB(200, 150, 50) 'For Testing
    Me.Controls(CtrlIdx) = C
    CtrlIdx = CtrlIdx + 1
Next
 
CtrlIdx = 12
For Each C In Range("actual")
    'Me.Controls(CtrlIdx).BackColor = RGB(256, 150, 0) 'For Testing
    Me.Controls(CtrlIdx) = C
    CtrlIdx = CtrlIdx + 1
Next
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,181
Members
452,893
Latest member
denay

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
Back
Top