Passing data to a variable number of TextBoxes in a user form

Jat999

New Member
Joined
May 7, 2016
Messages
49
Hi all

I have a user form which can have up to 10 Textboxes. These are numbered Tbx1 through to Tbx10.

The user inputs a value into a seperate textbox upto a maximum of 10. For the purpose of this example, lets suggest a value of 5.

The code then needs to populate Tbx1 to Tbx5 with same data.


Code:
   For M = 1 ToNum_Mix
Code:
[FONT=Calibri][COLOR=#000000]       mix_Ctrl.Sap_Code & M = ActiveCell.Offset(0, 1).Value[/COLOR][/FONT]
[FONT=Calibri][COLOR=#000000]    Next M [/COLOR][/FONT]

Where M = User input variable
mix_Ctrl is the user form
Sap_Code"n" are the variable number of textboxes

I was trying with a loop by trying to concaternate the variable M appended to Sap_Code but Excel does not like this.

Any suggestions please?


TIA John



<strike></strike><strike></strike>
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
No need to answer - I have solved with the following code

Code:
 Me.Controls("Sap_Code" & M) = ActiveCell.Offset(0,1).Value
 
Upvote 0

Forum statistics

Threads
1,215,186
Messages
6,123,537
Members
449,106
Latest member
techog

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