format graphs in vba

jess89

New Member
Joined
Jul 26, 2011
Messages
3
Hi

How can I format a graph in a macro? For example I want no border line surrounding the graph, or change the font to arial.

I tried to get the command by recording, but the recorder doesnt show some formatting comands, like the one stated above.

Thanks in advance.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
You haven't said which object's font you want to change, but here's some code recorded in Excel 2003 that may help you:

Code:
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 26/07/2011 by Andrew
'
'
    ActiveSheet.ChartObjects("Chart 2").Activate
    ActiveChart.ChartArea.Select
    With Selection.Border
        .Weight = 2
        .LineStyle = 0
    End With
    Selection.Interior.ColorIndex = xlAutomatic
    Sheets("Sheet1").DrawingObjects("Chart 2").RoundedCorners = False
    Sheets("Sheet1").DrawingObjects("Chart 2").Shadow = False
    ActiveChart.Axes(xlValue).Select
    Selection.TickLabels.AutoScaleFont = True
    With Selection.TickLabels.Font
        .Name = "Arial"
        .FontStyle = "Regular"
        .Size = 10
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
        .Background = xlAutomatic
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,285
Members
452,902
Latest member
Knuddeluff

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