Coding problem inserting text into text box

Derek

Well-known Member
Joined
Feb 16, 2002
Messages
1,595
Hi

Can anyone help me with this coding problem that has been driving me nuts.

I want to select a text box and insert text, as in this example which works well.
Selection.Characters.Text = "mytext"

However what I am trying to do is for it to accept the text in A1 of the activesheet. I have tried code like this without success:

Selection.Characters.Text = "mytext" & Range("A1").Value
Selection.Characters.Text = Range("A1").Value

Also tried to dim Range("A1").Value as a string or variant without success.

Please can someone explain to me the correct way of doing this.

Many thanks in advance

regards
Derek
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
hi!
try this!
On design mode click properties and activate the textbox.
then look for the link cell and type A1.
anything you type in A1 will be refelcted in the textbox.
 
Upvote 0
Thanks Sixth Sense, I didn't think of that but how would I code that? My code opens a new text box, names it, then needs to insert whatever is in A1. After a bit of jiggerypoker it then deletes the text box.
After the initial load from A1, it doesn't need the link to A1 anymore. The advantage to me would be that I can easily change the text in A1 without having to change the code itself.

regards
Derek
 
Upvote 0
so you wan that be done in code

try this!

<font face=Courier New>TextBox1.LinkedCell = "A1"</FONT>

and to remove the link

<font face=Courier New>TextBox1.LinkedCell = ""</FONT>
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,172
Members
448,554
Latest member
Gleisner2

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