Sub RF_Chart_page()
'
' Reformat_Chart_page Macro
' Macro recorded 1/27/2006 by Michael J. Virostko
' Revised 7/14/2011 for Excel 2007 speed.
' Set up Overall Page size along with the Header and Footers
'
ActiveWindow.Zoom = 100
ActiveChart.Activate
Application.ScreenUpdating = False ' do all transfers in the background
Application.DisplayStatusBar = True
'
' Print Page Setup
'
With ActiveChart.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = _
"&""Times New Roman,Bold""COMPANY NAME" & Chr(10) & "&""Times New Roman,Regular""&8&F - &A"
.CenterFooter = ""
' .RightFooter = "&10Page &P" & Chr(10) & "Printed " & "&D"
.RightFooter = "&""Times New Roman,Bold""&10Page &P" & Chr(10) & "Printed " & "&D"
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.25)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.ChartSize = xlFullPage
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.BlackAndWhite = False
.Zoom = 100
End With
'For Excel 2007, Need to define the Chart Area size and are
' Define the Chart area (no border)
'
' ActiveChart.ChartArea.Select
ActiveChart.ChartArea.Top = 0
ActiveChart.ChartArea.Left = 0
ActiveChart.ChartArea.Width = 745 '735
ActiveChart.ChartArea.Height = 535 '530
ActiveChart.ChartArea.Border.Weight = xlHairline
ActiveChart.ChartArea.Border.LineStyle = xlNone
ActiveChart.ChartArea.Shadow = False
ActiveChart.ChartArea.Interior.ColorIndex = xlNone
'
' Define the area for the plot, needed only for Excel 2003
'
If 1 = 1 Then
' ActiveChart.PlotArea.Select
ActiveChart.PlotArea.Left = 25
ActiveChart.PlotArea.Width = 695
ActiveChart.PlotArea.Top = 50
ActiveChart.PlotArea.Height = 450
End If
'
' Set up graph to have only major gridlines
'
ActiveChart.PlotArea.Select
With ActiveChart.Axes(xlCategory)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With
With ActiveChart.Axes(xlValue)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With
'
' Format the plot area for white background, solid border.
'
' ActiveChart.PlotArea.Select
With Selection.Border
.ColorIndex = 1
.Weight = xlMedium
.LineStyle = xlContinuous
End With
Selection.Interior.ColorIndex = xlNone
'
' Set up major gridlines to be a dashed line
'
'
' xlCategory represents x
' xlvalue represents y
'
' Format the y-axis
'
' Selection.AutoScaleFont = True
ActiveChart.Axes(xlValue).MajorGridlines.Select
With Selection.Border
.ColorIndex = 57
.Weight = xlHairline
.LineStyle = xlDot
End With
ActiveChart.Axes(xlValue).AxisTitle.Select
With Selection.Font
.Name = "Times New Roman"
.FontStyle = "Bold"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
' .MinimumScale = 11.4
' .MaximumScale = 14.9
' .MinorUnit = 0.05
' .MajorUnit = 0.5
.Crosses = xlCustom
.CrossesAt = -200
' .ReversePlotOrder = False
' .ScaleType = xlLinear
' .DisplayUnit = xlNone
End With
With Selection.Border
.Weight = xlHairline
.LineStyle = xlAutomatic
End With
With Selection
.MajorTickMark = xlCross
.MinorTickMark = xlInside
.TickLabelPosition = xlNextToAxis
End With
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Times New Roman"
.FontStyle = "Bold"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
' Selection.TickLabels.NumberFormat = "0"
' Selection.TickLabels.NumberFormat = "0.0"
'
' Format the x-axis
'
ActiveChart.Axes(xlCategory).MajorGridlines.Select
With Selection.Border
.ColorIndex = 57
.Weight = xlHairline
.LineStyle = xlDot
End With
With Selection.Border
.Weight = xlHairline
.LineStyle = xlAutomatic
End With
ActiveChart.Axes(xlCategory).Select
With Selection
.MajorTickMark = xlCross
.MinorTickMark = xlInside
.TickLabelPosition = xlLow
' .MinimumScale = 0.6
' .MaximumScale = 1.2
' .MinorUnit = 0.01
' .MajorUnit = 0.05
.Crosses = xlCustom
.CrossesAt = -200
.ReversePlotOrder = False
' .ScaleType = xlLinear
.DisplayUnit = xlNone
End With
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Times New Roman"
.FontStyle = "Bold"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
' Selection.TickLabels.NumberFormat = "0.0"
' Selection.TickLabels.NumberFormat = "0.00"
' Selection.TickLabels.NumberFormat = "0"
ActiveChart.Axes(xlCategory).AxisTitle.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Times New Roman"
.FontStyle = "Bold"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
'
' Format the Chart Title
'
ActiveChart.ChartTitle.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Times New Roman"
.FontStyle = "Bold"
.Size = 14
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Deselect
'
' Reformat the various titles
'
ActiveChart.Axes(xlCategory).AxisTitle.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Times New Roman"
.FontStyle = "Bold"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.ReadingOrder = xlContext
.Orientation = xlHorizontal
End With
ActiveChart.Axes(xlValue).AxisTitle.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Times New Roman"
.FontStyle = "Bold"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.ReadingOrder = xlContext
.Orientation = xlUpward
End With
ActiveChart.ChartTitle.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Times New Roman"
.FontStyle = "Bold"
.Size = 14
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.ReadingOrder = xlContext
.Orientation = xlHorizontal
End With
'
' Force Legend to have a border, white soldid fill.
'
ActiveChart.Legend.Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlContinuous
End With
Selection.Shadow = False
With Selection.Interior
.ColorIndex = 2
.PatternColorIndex = 1
.Pattern = xlSolid
End With
' Selection.Interior.ColorIndex = xlNone
Selection.AutoScaleFont = False
With Selection.Font
.Name = "Times New Roman"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
.Background = xlTransparent
End With
Application.ScreenUpdating = True ' do all transfers in the background
End Sub