Member
|
OK so i have large amounts of data i want to plot graphs with. I got my hands on this code which plots graphs nice and does the job for one set of data i need to analyise. However the code is set up to plot 2 columns that are next to each other. I would like to plot 2 columns that are not next to each other.
Eg code set up to plot column i and j I would like to plot column d and j I have played around with the code and i must say i dont have a clue what im doing. Can anyone help me?? P.S Where would a good source be to learn how to plot excel graphs automatically using Visual basic editor?? The code is below: Sub Macro4() ' ' $Id$ ' myrow = 26 mycol = 2 Dim sheetname as String sheetname = ActiveSheet.Name Dim i As Integer For i = 1 To 2 Charts.Add ActiveChart.ChartType = xlXYScatter '"I107:J187" myrange = "I" & myrow & ":J" & (myrow + 80) ActiveChart.SetSourceData Source:=Sheets(sheetname).Range(myrange), _ PlotBy:=xlColumns ActiveChart.SeriesCollection(1).Name = "='" & sheetname & "'!R" & myrow & "C" & mycol ActiveChart.Location Where:=xlLocationAsNewSheet With ActiveChart .HasTitle = True .ChartTitle.Characters.Text = ActiveChart.SeriesCollection(1).Name .Axes(xlCategory, xlPrimary).HasTitle = False .Axes(xlValue, xlPrimary).HasTitle = False End With ActiveSheet.Name = ActiveChart.SeriesCollection(1).Name myrow = myrow + 81 Next i End Sub |
quote |
Veteran Member
Join Date: May 2004
Location: Chicago
|
Must...resist...urge...to rip on VB.
Sorry, I can't help you. VB and I don't get along. </worthlessness> |
quote |
Banging the Bottom End
Join Date: Jun 2004
|
Your best bet would be to copy your values so they are in adjoining rows. The code you posted generates a chart based on a range, which is best used in Excel when all the data in the range is contiguous (packed in one area).
DMB, You can rip on VB all you like, but having full programmatic control over Excel objects is incredibly powerful. |
quote |
Posting Rules | Navigation |
|
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Freelance Video Editor NEEDS HELP! | chaos123x | Purchasing Advice | 4 | 2005-03-18 10:31 |
Undelete files, Hex Editor | flail | Genius Bar | 0 | 2005-03-13 20:15 |
Visual quirk | HOM | Feedback | 9 | 2005-01-08 00:45 |
Text Editor | dfj225 | Third-Party Products | 8 | 2004-08-04 19:51 |
Visual Design -- heavy/light page elements | dfiler | Feedback | 0 | 2004-06-02 07:58 |