+ Reply to Thread
Results 1 to 11 of 11

Renaming Chart Title as the sheet name and text

  1. #1
    Forum Contributor
    Join Date
    08-14-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    257

    Renaming Chart Title as the sheet name and text

    I have a workbook with one chart on each page.
    I'm trying to get the chart title to be defined as the worksheet name and the word "Spectra"

    So for the sheet name "Peak 1" the chart title would be Sheetname &" Spectra"

    I know I'm going to have to define the sheet name in the code but I dont know how

    Has anyone got any ideas?

    Thanks
    John

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Renaming Chart Title as the sheet name and text

    Do you need this added to existing code that creates the chart, or a separate routine? If the former, can you post the code you have?
    Remember what the dormouse said
    Feed your head

  3. #3
    Forum Contributor
    Join Date
    08-14-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    257

    Re: Renaming Chart Title as the sheet name and text

    Please Login or Register  to view this content.
    Unfortunately I cannot get the Macro to work from the start so I have to create the charts manually then run the macro to format them as I need them. I then for some bizarre reason have to format them manually as I recorded a macro to Add error bars but it doesn't work. It runs thorough but doesn't add the bars or apply the formatting in the macro. The full very untidy code is below:

    Please Login or Register  to view this content.
    Last edited by jshaw82; 02-22-2013 at 08:07 AM.

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Renaming Chart Title as the sheet name and text

    Can you post a sample workbook for testing? I can't see any reason why your code couldn't do all of it in one go with some tweaking and tidying.

  5. #5
    Forum Contributor
    Join Date
    08-14-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    257

    Re: Renaming Chart Title as the sheet name and text

    Full Bore Live 1.xls

    What I want it to do is run through all 10 "peak" sheets in this book. The reason i'm trying to automate it is because there is about 20 books each with 10 worksheets that need this chart creating!

    Thanks if you can get this to work!

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Renaming Chart Title as the sheet name and text

    How's this?
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    08-14-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    257

    Re: Renaming Chart Title as the sheet name and text

    That is fantastic - the other bit that I could never get to work was this code that I recorded from a Macro

    Please Login or Register  to view this content.
    They're all meant to look like the chart in this file Peak 5.xls- this code formats as such and the last but is meant to delete the X error bars but it deletes the whole thing.
    If it can be incorporated into the code that you have supplied it would be great but if not i'll just edit the charts manually.

    Cheers John
    Last edited by jshaw82; 02-22-2013 at 01:06 PM.

  8. #8
    Forum Contributor
    Join Date
    08-14-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    257

    Re: Renaming Chart Title as the sheet name and text

    So i've come up with this, which works:

    Please Login or Register  to view this content.
    I'll add this to your code and it should be good to go, unless you think it could be tidier?

  9. #9
    Forum Contributor
    Join Date
    08-14-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    257

    Re: Renaming Chart Title as the sheet name and text

    In fact I will need your help in incorporating it.

  10. #10
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Renaming Chart Title as the sheet name and text

    Hi,

    copy paste the code below in any one of your sheet (vba).

    hope this helps.

    Happy Computing.

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    08-14-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    257

    Re: Renaming Chart Title as the sheet name and text

    Ok, i've messed around and made:

    Please Login or Register  to view this content.
    and added
    Please Login or Register  to view this content.
    To the end of your code and all seems okay so far - thanks for your support today romperstomper.
    .

+ 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