+ Reply to Thread
Results 1 to 3 of 3

Changing text in a text box on a chart

  1. #1
    Registered User
    Join Date
    08-27-2009
    Location
    Dundee
    MS-Off Ver
    Excel 2003
    Posts
    7

    Changing text in a text box on a chart

    I have a large data set which I need to generate a graph for each colum of data. The marco currently copies each colum in turn to a sheet where the data is put into a template chart, it then saves the chart to a file. Currenty the chart title is picked up from a cell for the coppied colum. However the current dataset has titles too lage for the chart title to take - so I would like to add a text box to the chart and for each colum of data change the text in the text box.

    I currently have this to add the text box to the chart

    ActiveSheet.ChartObjects("Chart 1").Activate
    ActiveChart.Shapes.AddTextbox(msoTextOrientationHorizontal, 10, 10, 750, _
    50).Name = "chart_title"

    I'm struggling with this bit where the text is imported

    ActiveSheet.ChartObjects("Chart 1").Activate
    ActiveChart.Shapes(chart_title).TextFrame.Characters.Text = Range("D3")


    Thanks in advance

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Changing text in a text box on a chart

    It would be helpful if you explained exactly what "struggling" means. If the code generates an error, what is the error description and what line of code is highlighted?

    I did notice you are missing quotes around the textbox name in this line.
    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    08-27-2009
    Location
    Dundee
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Changing text in a text box on a chart

    Thanks AlphaFrog- I didn't notice that they were missing - works now.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Changing Text Box background based on other cell text
    By Zonc in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-15-2014, 04:45 AM
  2. [SOLVED] Changing text in text boxes over all sheets
    By hambly in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-21-2014, 05:57 PM
  3. Replies: 1
    Last Post: 02-19-2014, 10:04 PM
  4. Text to Columns (changing data type to text)
    By rasikvekaria in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-17-2013, 05:44 PM
  5. changing import text default from general to text
    By shoshanako in forum Excel General
    Replies: 3
    Last Post: 02-17-2012, 08:22 AM
  6. Changing Text Colour of a Disabled Text Box
    By tsp397 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-03-2009, 07:08 AM
  7. Changing bolded text to quoted text
    By liya in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-24-2007, 07:35 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1