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

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
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,987
Messages
6,128,125
Members
449,425
Latest member
NurseRich

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