elotromateo
New Member
- Joined
- May 19, 2010
- Messages
- 42
I'm trying to update a data range for a graph, but the data is in another sheet and I do not know how to reference that sheet. Right now it just takes data from current sheet (blank cells) as opposed to the desired information.
Code:
Sub UpdateGraph()
'
' Macro1 Macro
'
Dim LastRow As Long
Sheets("Data Sheet").Select
LastRow = Range("B" & Rows.Count).End(xlUp).Row
Sheets("Graphs").Select
ActiveSheet.ChartObjects("Chart 3").Activate
ActiveChart.SeriesCollection(2).XValues = Range(Cells(3, 3), Cells(LastRow, 3))
ActiveChart.SeriesCollection(2).Values = Range(Cells(3, 15), Cells(LastRow, 15))
End Sub