PDA

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



bubby68
08-09-2012, 02:33 PM
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?

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

End With

CatDaddy
08-09-2012, 02:39 PM
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