Hi I am trying to read chart properties from one chart and apply to Another.
Everything seems to work except I can't get the linestyle of major gridlines to work. When I try to read the linestyle it give me the value of -4118 for a dashed line. Any thoughts on what I might be doing wrong? Thanks in advance. I assume the problem is with the CollectChartPropertiesFromChart() since it returns a very strange value for "ActiveChart.Axes(xlValue).MajorGridlines.Border.LineStyle "
Dim GridlinesColour As Variant
Dim GridlinesWeight As String
Dim GridlinesLineStyle As String
Sub CollectChartPropertiesFromChart()
If ActiveChart.Axes(xlValue).HasMajorGridlines Then GridlinesColour = ActiveChart.Axes(xlValue).MajorGridlines.Border.ColorIndex
If ActiveChart.Axes(xlValue).HasMajorGridlines Then GridlinesWeight = ActiveChart.Axes(xlValue).MajorGridlines.Border.Weight
If ActiveChart.Axes(xlValue).HasMajorGridlines Then GridlinesLineStyle = ActiveChart.Axes(xlValue).MajorGridlines.Border.LineStyle
End Sub
Sub ApplyChartProperties()
If ActiveChart.Axes(xlValue).HasMajorGridlines Then ActiveChart.Axes(xlValue).MajorGridlines.Border.ColorIndex = GridlinesColour
If ActiveChart.Axes(xlValue).HasMajorGridlines Then ActiveChart.Axes(xlValue).MajorGridlines.Border.Weight = GridlinesWeight
If ActiveChart.Axes(xlValue).HasMajorGridlines Then ActiveChart.Axes(xlValue).MajorGridlines.Border.LineStyle = GridlinesLineStyle
End Sub
Bookmarks