I know it's possible, just not sure how to edit my Macro code...
I've got a Macro recorded which adds data labels and formats them for a chart when "Checked." How do I edit this so that when I "Uncheck," it reverses the code? I imagine I can do a simple "If True, then X, if False then X" statement but I haven't had luck getting it just right.
Any thoughts welcome!
Current macro below:
Sub Toggle_Volume_Labels()
'
' Toggle_Volume_Labels Macro
'
'
ActiveSheet.ChartObjects("Chart 11").Activate
ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).ApplyDataLabels
ActiveChart.SeriesCollection(1).DataLabels.Select
Selection.NumberFormat = "[$-409]mmmmm;@"
Selection.NumberFormat = _
"[>=1000000] #,##0.0,,""M"";[>0] #,##0.0,""K"";General"
ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).DataLabels.Select
Selection.Position = xlLabelPositionAbove
Selection.Format.TextFrame2.TextRange.Font.Italic = msoTrue
Range("H1").Select
End Sub
I've got a Macro recorded which adds data labels and formats them for a chart when "Checked." How do I edit this so that when I "Uncheck," it reverses the code? I imagine I can do a simple "If True, then X, if False then X" statement but I haven't had luck getting it just right.
Any thoughts welcome!
Current macro below:
Sub Toggle_Volume_Labels()
'
' Toggle_Volume_Labels Macro
'
'
ActiveSheet.ChartObjects("Chart 11").Activate
ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).ApplyDataLabels
ActiveChart.SeriesCollection(1).DataLabels.Select
Selection.NumberFormat = "[$-409]mmmmm;@"
Selection.NumberFormat = _
"[>=1000000] #,##0.0,,""M"";[>0] #,##0.0,""K"";General"
ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).DataLabels.Select
Selection.Position = xlLabelPositionAbove
Selection.Format.TextFrame2.TextRange.Font.Italic = msoTrue
Range("H1").Select
End Sub