Chart Title change in macro

AndyFu

New Member
Joined
Sep 2, 2002
Messages
9
Sub FixTitle()
Workbooks("April_XP1.xls").Worksheets("Summary").ChartObjects(1).Chart. _
ChartTitle.Text = "Statistics for" & " " & Format(Date, "mmmmmmmm yyyy")

'Workbooks("April_XP1.xls").Worksheets("Summary").ChartObjects(1).Chart. _
' ChartTitle.Characters(Start:=1, Length:=24).Font


Workbooks("April_XP1.xls").Worksheets("Summary").ChartObjects(1).Chart. _
ChartTitle.Font.Name = "Arial"


Workbooks("April_XP1.xls").Worksheets("Summary").ChartObjects(1).Chart. _
ChartTitle.Font.FontStyle = "Bold"

Workbooks("April_XP1.xls").Worksheets("Summary").ChartObjects(1).Chart. _
ChartTitle.Font.Size = 9

Workbooks("April_XP1.xls").Worksheets("Summary").ChartObjects(1).Chart. _
ChartTitle.Font.Shadow = False

Workbooks("April_XP1.xls").Worksheets("Summary").ChartObjects(1).Chart. _
ChartTitle.Font.Colorindex = 1

End Sub

Now I need help with this line:
'Workbooks("April_XP1.xls").Worksheets("Summary").ChartObjects(1).Chart. _
' ChartTitle.Characters(Start:=1, Length:=24).Font

and if it's possible to do a With... I don't know I to do this.

Also, I would like to have the moth spelled out in it's entirety.

Helpppppp meee

Thanks
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
This seems to work OK (using your original code, the title appeared as 'Statistics for September September 2002'. Was that what you wanted, 'cos it looks a bit odd :smile:. The title for the code below will return Statistics for September 2002 in bold): -

Code:
Sub FixTitle()

With Workbooks("April_XP1.xls").Worksheets("Summary").ChartObjects(1).Chart. _
ChartTitle
    .Text = "Statistics for " & Format(Date, "mmmm yyyy")
    With .Font
        .Name = "Arial"
        .Bold = True
        .Size = 9
    End With
End With

End Sub
Edit- cleaned it up a little bit.
This message was edited by Mudface on 2002-09-04 09:47
 
Upvote 0
If I put 3 'm' : mmm it will only give me sept. but if I put 8 'm', I will have Septembe... but in December I will have every thing.... now for the moth of October, I will have 'OctoberO' because there is 8 letters...
 
Upvote 0
??

Entry for VBA help on Format: -
m Display the month as a number without a leading zero (1 – 12). If m immediately follows h or hh, the minute rather than the month is displayed.
mm Display the month as a number with a leading zero (01 – 12). If m immediately follows h or hh, the minute rather than the month is displayed.
mmm Display the month as an abbreviation (Jan – Dec).
mmmm Display the month as a full month name (January – December
 
Upvote 0
Your right lol

I don't get it... how come it wasen't working last night... anyway... it's working now. DAM MICROSOFT :razz: lol

Thanks for helping me with those 2 issues.
 
Upvote 0

Forum statistics

Threads
1,224,881
Messages
6,181,536
Members
453,054
Latest member
ezzat

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top