Consulting

Results 1 to 2 of 2

Thread: How can I change part of my title by referencing a value in a cell?

  1. #1
    VBAX Regular
    Joined
    Aug 2012
    Posts
    6
    Location

    How can I change part of my title by referencing a value in a cell?

    Hi ,
    Below is my code for my title. The thing I would like to change is the 'AB' part of the tile. It stands for Alberta...but when I ship this code to BC they would have to go through all my code and change each title to BC. I have about 15 graphs in my workbook...the title will stay the same except for the area. Is there any way I could reference a cell on my 'Data Update Options' sheet where they could type BC and all the titles would reflect that change by referencing a macro variable of some sort?

    [VBA]With ActiveChart
    .HasTitle = True
    .ChartTitle.Text =
    "Hypertension - Crude prevalence counts - AB 1998/99-2008/09"

    End With[/VBA]

  2. #2
    VBAX Expert CatDaddy's Avatar
    Joined
    Jun 2011
    Posts
    581
    Location
    [VBA]Dim mod as String
    mod = ActiveWorkbook.Sheets(1).Range("A1").Text
    'Change Range as desired

    With ActiveChart
    .HasTitle = True
    .ChartTitle.Text = "Hypertension - Crude prevalence counts - " & mod & " 1998/99-2008/09"

    End With
    [/VBA]
    ------------------------------------------------
    Happy Coding my friends

Posting Permissions

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