RAGTIME333
New Member
- Joined
- Jun 23, 2009
- Messages
- 2
Hi I am new to VB and recorded a macro to update a number of graphs in a number of worksheets with additional data. This is what i recorded
Sub EDITCHART2()
'
' EDITCHART2 Macro
' Macro recorded 6/23/2009 by mcarag
'
' Keyboard Shortcut: Ctrl+Shift+W
'
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(1).XValues = "=(Q11.5!R11C2:R15C2,Q11.5!R17C2)"
ActiveChart.SeriesCollection(1).Values = "=(Q11.5!R11C3:R15C3,Q11.5!R17C3)"
ActiveChart.SeriesCollection(2).XValues = "=(Q11.5!R11C2:R15C2,Q11.5!R17C2)"
ActiveChart.SeriesCollection(2).Values = "=(Q11.5!R11C4:R15C4,Q11.5!R17C4)"
ActiveChart.SeriesCollection(3).XValues = "=(Q11.5!R11C2:R15C2,Q11.5!R17C2)"
ActiveChart.SeriesCollection(3).Values = "=(Q11.5!R11C5:R15C5,Q11.5!R17C5)"
End Sub
However I want the macro to reference each worksheet I run it in, rather than Q11.5 each time. Simple I'm sure and let here I sit...
Sub EDITCHART2()
'
' EDITCHART2 Macro
' Macro recorded 6/23/2009 by mcarag
'
' Keyboard Shortcut: Ctrl+Shift+W
'
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(1).XValues = "=(Q11.5!R11C2:R15C2,Q11.5!R17C2)"
ActiveChart.SeriesCollection(1).Values = "=(Q11.5!R11C3:R15C3,Q11.5!R17C3)"
ActiveChart.SeriesCollection(2).XValues = "=(Q11.5!R11C2:R15C2,Q11.5!R17C2)"
ActiveChart.SeriesCollection(2).Values = "=(Q11.5!R11C4:R15C4,Q11.5!R17C4)"
ActiveChart.SeriesCollection(3).XValues = "=(Q11.5!R11C2:R15C2,Q11.5!R17C2)"
ActiveChart.SeriesCollection(3).Values = "=(Q11.5!R11C5:R15C5,Q11.5!R17C5)"
End Sub
However I want the macro to reference each worksheet I run it in, rather than Q11.5 each time. Simple I'm sure and let here I sit...