Excel Variable Charting

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?
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
There is probably an easier way for you to accomplish this without using VBA. If you post a sample of your data we can probably apply some dynamic charting techniques to get the job done.
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,752
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top