+ Reply to Thread
Results 1 to 3 of 3

Setting the Chart name as the text from a cell.

  1. #1
    Sareh
    Guest

    Setting the Chart name as the text from a cell.

    Hey everyone,

    So I have this code that scrolls through each column and uses each
    column as the y-axis and outputs a different chart with each increment.
    I was able to set up the title of each chart so that it shows the
    heading of each column as the title, but now I want the tab on the
    bottom of the chart to have this same title (which was obtained from
    the first cell of each column). This is the code I have for the title
    of each graph and it works fine :

    ActiveChart.SeriesCollection(1).Name = "=Sheet1!R1C" & C
    'C refers to the column index
    The title is "Protein 1," which is located in Row 1 Column C.

    But for some reason when I tried to use this code to change the tab
    name of each chart, it didn't work:
    ActiveChart.ChartTitle.Parent.Name = "=Sheet1!R1C" & C
    Instead of displaying "Protein 1" on the chart tab on the bottom, it
    displays: =Sheet1!R1C4
    'The C value works and increments, but for some reason it doesn't see
    the reference to output the text of the first row, 4th column cell.


    Any ideas would be greatly appreciated!


    Thanks,
    Sareh


  2. #2
    mpeplow
    Guest
    Idea - Not Solution

    Change
    ActiveChart.ChartTitle.Parent.Name = "=Sheet1!R1C" & C

    to
    ActiveChart.ChartTitle.Parent.Name = Sheet1!R1C.text & " " & C

  3. #3
    mpeplow
    Guest
    Sorry, Ignore my last post. Basically you have your title enclosed with "" which usually tells the program to 'treat as string' you need to have a non-text refernce or create a new text variable to store your string in.

    I know this does not solve your problem but I hope that you got something out of it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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