Hi guys,
I am using excel to product charts based on how many selections a user makes. i.e. if 5 brands are selected then the user clicks update graph, then the graph will relocate the range and update the graph.
Sub UpdateGraphs()
ActiveSheet.ChartObjects("Chart 117").Activate
ActiveChart.ChartArea.Select
ActiveChart.PlotArea.Select
ActiveChart.SetSourceData Source:=Sheets("GraphData").Range("A26:Indirect(B24)"), _
PlotBy:=xlRows
ActiveChart.ChartArea.Select
ActiveChart.Legend.Select
Selection.AutoScaleFont = False
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 6
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
End Sub
That is my what I have so far and it works fine, however if a user selects no brands and clicks update graph then I get the runtime error 1004, as the range becomes invalid, How can I create an error message pop up instead?
Any help would be great
Thanks,
Bookmarks