How to get a macro to work in all worksheets
Closed
Robbo
-
Apr 14, 2016 at 08:16 AM
Robbo166 Posts 2 Registration date Thursday April 14, 2016 Status Member Last seen April 14, 2016 - Apr 14, 2016 at 07:31 PM
Robbo166 Posts 2 Registration date Thursday April 14, 2016 Status Member Last seen April 14, 2016 - Apr 14, 2016 at 07:31 PM
Related:
- How to get a macro to work in all worksheets
- Spell number in excel without macro - Guide
- Transfer data from one excel worksheet to another automatically - Guide
- Excel macro to create new sheet based on value in cells - Guide
- Macros in excel download free - Download - Spreadsheets
- Run macro on opening workbook - Guide
Apr 14, 2016 at 05:38 PM
Apr 14, 2016 at 07:31 PM
The following is the code that I changed. I get a runtime error message 1004. When I close the VB page, the chart is showing correctly. As others will be using this I can't have the error message showing
Sub MelbourneMonthlyProfitChart()
'
' MelbourneMonthlyProfitChart Macro
'
' Keyboard Shortcut: Ctrl+Shift+M
'
Range("A1:G1,A5:G5").Select
Range("A5").Activate
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ApplyChartTemplate ( _
"C:\Users\Robertson\AppData\Roaming\Microsoft\Templates\Charts\Travel Destination Monthly Chart for Managers resized.crtx" _
)
ActiveChart.SetSourceData Source:=ActiveSheet.Range( _
"!$A$1:$G$1,!$A$5:$G$5" _
)
ActiveChart.ChartTitle.Select
Selection.Caption = "=!R5C1"
End Sub
The ActiveChart.SetSourceData section is showing as yellow indicating errors.
What do I need to change in this. Thanks so much in advance