![]() |
Creating charts from a .dat file with vba.
Hi there,
I'm trying using excel vba to create multiple charts from data in a dat file. The data comes in as a long list. I've created a loop to get the data and plot it to different charts but my lack of experience with vba is preventing me from getting it to work. This is my code Sub DataChart() Dim Irow As Long Dim i As Integer Dim srsNew As Series Irow = 5 i = 5 Do Until i 5565 For j = 1 To 3 '' Create the chart Charts.Add ActiveChart.ChartType = xlXYScatter ActiveChart.Location Whe=xlLocationAsNewSheet '' Add the series Set srsNew = ActiveChart.SeriesCollection.NewSeries With srsNew .Name = "Cells(Irow, 2)" .Values = ActiveSheet.Range(Cells(i, j), Cells(i + 82, j)) .XValues = ActiveSheet.Range(Cells(Irow, 1), Cells(Irow + 82, 1)) End With Next j i = i + 83 Irow = Irow + 83 Loop End Sub I would appreciate any help or advice. Thanks, Simon. |
All times are GMT +1. The time now is 08:30 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com