Newtonpersquaremetre
New Member
- Joined
- Nov 22, 2016
- Messages
- 8
[h=1][/h]
<tbody style="margin: 0px; padding: 0px; border: 0px;">
</tbody>
up vodown votefavorite | Hello! I have some data on a table("FSTHR_tests") in the worksheet ("Project Results") and want to extract some of the data to make some graphs, which will be diplayed in UserForm1. Below is my attempt to the code. I get the error: 'Method 'Values" of object "Series" failed. Any assistance would be greatly appreciated! <code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;">Private Sub cmdLoad_Click() If ComboBox1.Text = "Select Chart" Then MsgBox "Select a chart from the dropdown list" Exit Sub Dim MyChart As Chart Dim ChartData As Range Dim chartIndex As Integer Dim ChartName As String chartIndex = ComboBox4.ListIndex Select Case chartIndex Case 0 Set ChartData = Worksheets("Project Results").ListObjects("FSTHR_tests").ListColumns("Avg-Burn Time (s)").DataBodyRange ChartName = Avg_Burn_Time End Select End If Application.ScreenUpdating = False Set MyChart = Worksheets("Project Results").Shapes.AddChart(xlXYScatterLines).Chart MyChart.SeriesCollection.NewSeries MyChart.SeriesCollection(1).Name = ChartName MyChart.SeriesCollection(1).values = ChartData MyChart.SeriesCollection(1).XValues = Worksheets("Project Results").ListObjects("FSTHR_tests").ListColumns("#") Dim imageName As String imageName = Application.DefaultFilePath & Application.PathSeparator & "TempChart.gif" MsgBox "The default file path is " & Application.DefaultFilePath MyChart.Export Filename:=imageName, FilterName:="GIF" Worksheets("Project Results").ChartObjects(1).Delete Application.ScreenUpdating = True UserForm1.Image1.Picture = LoadPicture(imageName) </code>Please note that the case is not done yet. There will be many more graphs to follow. I only want to get my code working for one graph. Further, The error is on the line <code style="margin: 0px; padding: 1px 5px; border: 0px; font-size: 13px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; background-color: rgb(239, 240, 241); white-space: pre-wrap;">MyChart.SeriesCollection(1).values = ChartData</code> |
<tbody style="margin: 0px; padding: 0px; border: 0px;">
</tbody>