baka_giraffe
New Member
- Joined
- May 22, 2011
- Messages
- 4
Hi, i got some datas whereby it will be a headache to read at them. It would be easier for me to look them in charts. I have done in vba in this way
Sub Chart2()
Dim yRange As Range
Dim xRange As Range
Set xRange = ActiveSheet.Range("O7:AC7")
Set yRange = ActiveSheet.Cells( _
ActiveCell.Row, 1).Range("O1:AC1")
With ActiveSheet.ChartObjects(1)
.Chart.ChartArea.Clear
.Chart.SetSourceData Source = Range("yRange +& xRange"), PlotBy:= _
xlRows
.Chart.ChartType = xlXYScatterLines
End With
End Sub
The problem is there is a runtime error of 1004, range of object _global failed
What i wanted is that
once i click on a certain cell, that row of cells will form a chart with x axis as o7:ac7, y axis as the row of cells found in column O:AC.
How else can i perform this?
Sub Chart2()
Dim yRange As Range
Dim xRange As Range
Set xRange = ActiveSheet.Range("O7:AC7")
Set yRange = ActiveSheet.Cells( _
ActiveCell.Row, 1).Range("O1:AC1")
With ActiveSheet.ChartObjects(1)
.Chart.ChartArea.Clear
.Chart.SetSourceData Source = Range("yRange +& xRange"), PlotBy:= _
xlRows
.Chart.ChartType = xlXYScatterLines
End With
End Sub
The problem is there is a runtime error of 1004, range of object _global failed
What i wanted is that
once i click on a certain cell, that row of cells will form a chart with x axis as o7:ac7, y axis as the row of cells found in column O:AC.
How else can i perform this?