chart formatting

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need a macro that will, with the selected graph, do some operations to the
axis font (both primary and secondary), as well as a few other things, before
selecting the next graph in the page.

Any code help that can get me started on these tasks (I'm hoping once I see
the format of how to do the format manipulations, I can figure out the other
things I need to do, which are also formatting related).

Thx.
 
Try turning on the macro recorder (under the tools=>Macro=>Record a new
macro) and then perform the actions manually. Then turn off the macro
recorder and see what you have.
 
thanks, but that doesn't do it. It won't record the actions within the
graphs, for some reason. Do you know the code otherwise? Otherwise, I'll
repost, as I tend to find no one looks at things that have responses, even if
the question remains unanswered.
 
It recorded fine for me:

Sub Macro7()
'
' Macro7 Macro
' Macro recorded 06/18/2007 by OGILVTW
'

'
ActiveChart.Axes(xlValue, xlPrimary).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "AvantGarde"
.FontStyle = "Regular"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlValue, xlSecondary).Select
Selection.TickLabels.NumberFormat = "#,##0,"
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Book Antiqua"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
End Sub
 
Excel 2007's macro recorder has been crippled when formatting charts and
shapes. I guess they ran out of time to encode these new elements. If you
still have Excel 2003 or earlier installed somewhere, use the macro recorder
in this version, and use that code as an example.

- Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top