Need to plot a range without inner quotes

kosmoclone

New Member
Joined
Mar 28, 2011
Messages
7
Hi,
I'm trying to plot a range of numbers:
Col G Col H
10 4.5
20 6
30 8.3

I'm selecting the data using
[G9].select
selection.End(xlDown).select
k = ("G9:" & "G" & Activecell.Row)

[H9].select
selection.End(xlDown).select
o = ("H9:" & "H" & Activecell.Row)

Range(k,0).select
'This will actually be viewed as Range("G9:G13","H9:H13") and I need it to be: Range("G9:G13, H9:H13) 'Notice the inner quotes are gone'

Activesheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlXYScatter

I want the 10,20,30 column to be the X axis values and not to be plotted.

Thanks.
 
I have tried to record a macro but there is limited information there and if I try to run the recorded macro it will plot both columns which is incorrect. It will plot correctly in VB if the range is range("G9:G13, I9:I13") with the quotes missing between G13 and I9.

Here is the code that inserts the plot:

Sub plot2()
Dim k, o, t1 As string


k = Range("G9").End(xlDown).Row
o = Range("H9").End(xlDown).Row
Range("G9:G" & k & ",H9:H" & o).Select


ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlXYScatter

Followed by some formatting options.

Thanks.
 
Upvote 0

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi,

I figured out that I need the following line of code after creating the XYscatter:
ActiveChart.SetSourceData Source:=Range(k, o)

Thanks.
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,254
Members
452,900
Latest member
LisaGo

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