activex textbox text change

ulver

New Member
Joined
Oct 11, 2016
Messages
7
I've been trying to figure out a way to change the text value of 47 activex textboxes without naming them all individually.
while both below codes work on single textboxes:
VBA Code:
Sheets("LOSS").OLEObjects("TextBox2").Object.Text = "None" '(example1)
Sheets("LOSS").TextBox1.Value = "None" '(example2)

I cannot get the variable part to work at all

VBA Code:
Dim i As Integer
For i = 1 To 47
Sheets("LOSS").OLEObjects("TextBox & i").Object.Text = "None" '(example1)
Sheets("LOSS").TextBox & i.Value = "None" '(example2)
next i

seems like I'm missing something stupidly easy, does anyone have any suggestions? the text I want to change them too will always be "None"
I was linking these to a cell and changing the cell, but the code took too long, so I want to see if this will be a speed improvement doing it this way.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
ha, it was stupid, had the quotes around & i instead of just textbox, works now!
 
Upvote 0
Solution

Forum statistics

Threads
1,223,877
Messages
6,175,139
Members
452,615
Latest member
bogeys2birdies

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