MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Using Variable Sheet Name in Series Name Definition

Posted by Dazed and Confused on April 19, 2001 6:06 AM

I have (unsuccessfully) been trying to figure out the correct syntax for
using a variable name for the worksheet in the following expression:

ActiveChart.SeriesCollection(1).Name = "=Sheets(Sheetneeded)!R1C6"

Can you give me any clues here? Thanks in advance.


Posted by Barrie Davidson on April 19, 2001 7:57 AM

Hi John, try this (assumes that "Sheetneeded" is the variable's name and that the value you want to set "Sheetneeded" is one row down and six columns across from the active cell in your spreadsheet) -

Sheetneeded = Activecell.Offset(1,6).Value
ActiveChart.SeriesCollection(1).Name = Sheetneeded

Hope this helps you out.