VBA loop on TextBoxes and give them a value

makiwara

Board Regular
Joined
Mar 8, 2018
Messages
171
Hi!

I'm stuck with my idea. I tried to figure out but seems complicated.

There is an Excel table where there are TextBoxes inserted, something like:

TEXTBOX
empty row
TEXTBOX
empty row
empty row
TEXTBOX

...

So the main thing is that there aren't overlapping textboxes.

Is it possible to loop through them? From above to down?

And give each a value?

Cells:

red apple healthy
yellow zitrone delicious
...

Textbox1: red
T2: apple
T3: healthy
T4:yellow
T5: zitrone
T6: delicious

(Every 3. TextBox has the same size, since we have 3 different data to put in)

Thank you very much for your help!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Thank you. I can't use cells, since I insert a picture as background and the textboxes are on the pictures. Every textbox has to have a different value, based on algorythm written above.

Thank you for your help!
 
Last edited:
Upvote 0
I tried to solve, but seems impossible to loop through userforms. (they have an ascendent order, so looping through 1-2-3 and so on would be great.
In my example I want to add Cells(2,2).Value to all textbox-es, through loop.

If I knew how to do this, I would be able to modify the code to suit my needs. Thank you if somebody have an idea! Have a very nice day! :-)

Code:
Sub test()


Dim i As Integer
For i = 1 To 100 Step 1


temp = TextBox & i


temp.Text = Sheets("2").Cells(2, 2).Text


Next




End Sub
Why do you need textboxes?
the sheet has a million cells. Can't you just use a cell?
 
Upvote 0
Anybody? I am really sorry to ask this silly question, but I find solution just working with former versions of Excel, not 2016
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,213
Members
452,618
Latest member
Tam84

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