How to change weight of line in XY chart

C

choi1chung1gm

Dear Experts

This macro works fine and plots the xy graph using four columns of
data in sheet1. How can I change the weight of the line for series (1)
from xlThin to xlThick ? I tried using the .SeriesCollection(1).Weight
= xlThick but it did not work. Please help.

thanks

Choi


Sub plotgraph()

'***********START graph plot***********
Sheets("sheet1").Activate
Cells(1, 1).Select
'Lastrow = Cells(Rows.Count, 1).End(xlUp).Row
Lastrow = 20000
StartRow = 10

With ActiveSheet.ChartObjects.Add _
(Left:=6, Width:=228, _
Top:=Cells(StartRow, 1).Top, Height:=240)
With .Chart
.ChartType = xlXYScatterSmoothNoMarkers
.SetSourceData Source:=Sheets("Sheet1") _
.Range(Cells(1, 1), Cells(Lastrow, 2)), PlotBy _
:=xlColumns
.HasLegend = True
.SeriesCollection(1).Name = "=""data1"""
.HasTitle = True
.ChartTitle.Characters.Text = "mydata"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "t(s)"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Pr(kPa)"
.Legend.Position = xlTop
.ChartArea.AutoScaleFont = False
.ChartArea.Font.Size = 8
.PlotArea.Interior.ColorIndex = xlNone
.SeriesCollection.NewSeries
.SeriesCollection(2).XValues = Sheets("Sheet1"). _
Range(Cells(1, 3), Cells(Lastrow, 3))
.SeriesCollection(2).Values = Sheets("Sheet1"). _
Range(Cells(1, 4), Cells(Lastrow, 4))
.SeriesCollection(2).Name = "=""data2"""
.PlotArea.Width = 220
.PlotArea.Height = 160
.PlotArea.Left = 16
.PlotArea.Top = 40
End With
End With

'***********END graph plot***********

End Sub
 
J

Jon Peltier

Next time, do it yourself while recording a macro. That's probably what
Peter did, and what I would have done if he hadn't already answered.. You'll
get the syntax correct in two seconds.

- Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top