+ Reply to Thread
Results 1 to 1 of 1

VBScript to Change Chart Title Within Worksheet

Hybrid View

Oriana VBScript to Change Chart... 12-17-2007, 04:20 PM
  1. #1
    Registered User
    Join Date
    08-06-2007
    Posts
    35

    Unhappy VBScript to Change Chart Title Within Worksheet

    Hi all!

    I am not familiar with VBscript at all, so please go easy on me. There is a document I've been working on in Excel for quite some time, but another person added in some macros.

    Basically, the first macro looks for a defined date within one of the worksheets and changes the date within the headers on all pages.

    After that, there are various macros set that change the titles of different charts. For example, one chart may be titled, "Surveys Returned = #" and it will go to another worksheet, look for the defined #, and then insert it into the title.

    There are 8 macros of this sort that have worked fine up until now.

    Now I have an actual worksheet that has a chart inserted into it, so it's actually lying on top of the cells instead of being a separate chart sheet (it has to be this way for a few reasons).

    The following code is how we've been changing the titles in these charts when they're simply chart sheets:

    Sub Macro10()
    '
    ' Macro10 Macro
    ' Batch Work BW
    
    '
        Sheets("Survey Data Tables").Select
        Range("B4").Select
        I = ActiveCell.Value
        
        Sheets("Batch Work BW").Select
        ActiveChart.ChartTitle.Select
        Application.CutCopyMode = False
        
        Selection.Characters.Text = "Surveys By Channel Received:  Batchwork" & Chr(10) & "Total Mailed for Channel Received:  Batchwork = " & H & Chr(10) & "" & Chr(10) & ""
        Selection.AutoScaleFont = False
        With Selection.Characters(Start:=1, Length:=41).Font
            .Name = "Arial"
            .FontStyle = "Bold"
            .Size = 12
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ColorIndex = xlAutomatic
        End With
    End Sub
    I need to take this code and change it so it actually points to the chart within the worksheet. How do I go about doing that?
    Last edited by Oriana; 12-17-2007 at 04:48 PM.

+ 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