User Name
Password
AppleNova Forums » Genius Bar »

Visual Basic editor


Register Members List Calendar Search FAQ Posting Guidelines
Visual Basic editor
Thread Tools
cyrusmekon
Member
 
Join Date: Aug 2004
Location: Melbourne
Send a message via AIM to cyrusmekon Send a message via Yahoo to cyrusmekon  
2005-04-28, 09:35

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
DMBand0026
Veteran Member
 
Join Date: May 2004
Location: Chicago
 
2005-04-28, 12:28

Must...resist...urge...to rip on VB.

Sorry, I can't help you. VB and I don't get along.

</worthlessness>
  quote
bassplayinMacFiend
Banging the Bottom End
 
Join Date: Jun 2004
 
2005-04-28, 12:55

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
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Post Reply

Forum Jump
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


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 01:38.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2024, AppleNova