Set Y and X axis values

matheusand9

New Member
Joined
Jan 19, 2016
Messages
1
Hello

I'm having a small problem which I just can't solve as I'm a very beginner in Excel VBA.
I've been searching for different examples since last week but it doesn't really works. It's quite important for me so I'd really appreciate if someone could help me.
I'd like to make a chart from a .csv file with my values beginning from from the 1342th line until the 4119th. For the Y axis I'd like to use the H column and for X axis, I'd like the B column.

That's what I've done for the moment:
Code:
Sub mychart()


    Dim sheet As Chart
    Set sheet = Charts.Add
    
    With sheet
        .SetSourceData Source:=Sheets("Essai1.steps.tracking").Range("H1342:H4119")
        .ChartType = xlLine
        .HasTitle = True
        .ChartTitle.Text = "Contrainte"
        .XValues = Worksheets("Essai1.steps.tracking").Range("B1342:B4119")       
    End With


End Sub
 

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.

Forum statistics

Threads
1,214,979
Messages
6,122,559
Members
449,089
Latest member
Motoracer88

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