Format Axis, Title font size and color : Chart Format « Excel « VBA / Excel / Access / Word

VBA / Excel / Access / Word
1. Access
2. Application
3. Data Type
4. Data Type Functions
5. Date Functions
6. Excel
7. File Path
8. Forms
9. Language Basics
10. Math Functions
11. Outlook
12. PowerPoint
13. String Functions
14. Windows API
15. Word
16. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
VBA / Excel / Access / Word » Excel » Chart Format 
Format Axis, Title font size and color
 
Sub FormattingCharts()
    Dim myChart As Chart
    Dim ws As Worksheet
    Dim ax As Axis

    Set ws = ThisWorkbook.Worksheets("Sheet1")
    Set myChart = GetChartByCaption(ws, "GDP")

    If Not myChart Is Nothing Then
        Set ax = myChart.Axes(xlCategory)
        With ax
            .AxisTitle.Font.Size = 12
            .AxisTitle.Font.Color = vbRed
        End With
    End If

    Set ax = Nothing
    Set myChart = Nothing
    Set ws = Nothing
End Sub
Function GetChartByCaption(ws As Worksheet, sCaption As StringAs Chart
    Dim myChart As ChartObject
    Dim myChart As Chart
    Dim sTitle As String

    Set myChart = Nothing
    For Each myChart In ws.ChartObjects
        If myChart.Chart.HasTitle Then
            sTitle = myChart.Chart.ChartTitle.Caption
            If StrComp(sTitle, sCaption, vbTextCompareThen
                Set myChart = myChart.Chart
                Exit For
            End If
        End If
    Next
    Set GetChartByCaption = myChart
    Set myChart = Nothing
    Set myChart = Nothing
End Function

 
Related examples in the same category
1. Manipulating Charts
2. Adds major gridlines, title, and x-axis labels to an embedded chart
3. Loop through each series in chart and alter marker colors
4. Add Chart Sheet
5. Background and Foreground color
6. Working with a Chart Axis
7. Formatting a Basic Chart
8. Set Axes gridline and its border color
9. Set PlotArea LineStyle, border color, width and height
10. Looping through the ChartObjects collection: changes the chart type of every embedded chart on the active sheet.
11. works on all the chart sheets in the active workbook
12. Modifying chart properties: changes the Legend font for all charts on the active sheet.
13. Applying chart formatting
14. Changing a Chart Title Using VBA
15. To fill the bars of a data series with a picture
16. sets up a two-color gradient using two theme colors:
17. formats the trendline for the first series in a chart:
18. formatting a border
19. adds a line around the title and adds a glow around that line:
20. adds a light blue shadow to the box surrounding a legend:
21. proper syntax for SoftEdge:
22. Format Soft Edges With Loop
23. To apply one of the 3-D rotation presets to a chart element: use the SetPresetCamera method
24. Changing the Bevel and 3-D Format
25. defines a Chart object variable and a ChartGroup object variable and then stops:
26. creates the chart with absolute reference and format it
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.