Addressing a text box in a chart

  • Thread starter Thread starter Emil
  • Start date Start date
E

Emil

Hello,

I want to “tag” different areas of a chart in Sheet1 with clarifyin
text using VBA-code. Therefore I have created a textbox (Text Box 1
with the tool in the “drawing”-toolbar. This textbox is positione
within the area of chart1 that sits in sheet1 in the open workbook. Ho
do I address the text in Text Box 1 and change it to a string defined i
VBA? Would be great if someone could help me with this!

Thanks in advance!

//Emi
 
Hi Emil,

Something like this, alter indexes as needed.

activesheet.chartobjects(1).chart. _
shapes(1).textframe.characters.text = "HELLO"

Or another way would be to link the textbox to a cell, select the
textbox and then enter a cell reference into the formula bar (include =
and sheetname). Then you can alter the cell and the textbox will update
automatically.

Cheers
Andy
 
Try

Sub TextInBox()
ActiveSheet.Shapes("Text Box 1").Select
Selection.Characters.Text = "This is text"
ActiveCell.Select
End Sub

regards'Don
 
Thanks Don and Andy, it works great!
Now my users might understand what this chart is all about...

//Emi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top