If you want to hide or un-hide chart axis. Try this macro
Macro to hide chart Axis
Sub hide_chart_axis()
Dim cht As Chart
'change chart name here
Set cht = Sheets("Sheet1").ChartObjects("Chart 3").Chart
With cht.Axes(xlValue, xlPrimary)
.Border.LineStyle = xlNone
.MajorTickMark = xlNone
.MinorTickMark = xlNone
.TickLabelPosition = xlNone
End With
With cht.Axes(xlCategory, xlPrimary)
.Border.LineStyle = xlNone
.MajorTickMark = xlNone
.MinorTickMark = xlNone
.TickLabelPosition = xlNone
End With
End Sub
Macro to un-hide chart Axis
Sub un_hide_chart_axis()
Dim cht As Chart
'change chart name here
Set cht = Sheets("Sheet1").ChartObjects("Chart 3").Chart
With cht.Axes(xlValue, xlPrimary)
.Border.Weight = xlHairline
.MajorTickMark = xlNone
.MajorTickMark = xlTickMarkOutside
.TickLabelPosition = xlLow
End With
With cht.Axes(xlCategory, xlPrimary)
.Border.Weight = xlHairline
.Border.LineStyle = xlContinuous
.MajorTickMark = xlTickMarkOutside
.MinorTickMark = xlNone
.TickLabelPosition = xlLow
End With
End Sub
Macro to hide chart Axis
Sub hide_chart_axis()
Dim cht As Chart
'change chart name here
Set cht = Sheets("Sheet1").ChartObjects("Chart 3").Chart
With cht.Axes(xlValue, xlPrimary)
.Border.LineStyle = xlNone
.MajorTickMark = xlNone
.MinorTickMark = xlNone
.TickLabelPosition = xlNone
End With
With cht.Axes(xlCategory, xlPrimary)
.Border.LineStyle = xlNone
.MajorTickMark = xlNone
.MinorTickMark = xlNone
.TickLabelPosition = xlNone
End With
End Sub
Macro to un-hide chart Axis
Sub un_hide_chart_axis()
Dim cht As Chart
'change chart name here
Set cht = Sheets("Sheet1").ChartObjects("Chart 3").Chart
With cht.Axes(xlValue, xlPrimary)
.Border.Weight = xlHairline
.MajorTickMark = xlNone
.MajorTickMark = xlTickMarkOutside
.TickLabelPosition = xlLow
End With
With cht.Axes(xlCategory, xlPrimary)
.Border.Weight = xlHairline
.Border.LineStyle = xlContinuous
.MajorTickMark = xlTickMarkOutside
.MinorTickMark = xlNone
.TickLabelPosition = xlLow
End With
End Sub
No comments:
Post a Comment