473,804 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VBA Macro Creates Scatter Plot in 2003, Adds Lines in 2007???

3 New Member
I have the following macro. It works fine, creating an XY scatter plot in Excel 2003, but when one of my users runs it in Excel 2007, it creates a scatter plot with lines. Why does it do this? I am using "ChartType = xlXYScatter", not xlXYScatterLine s.

Expand|Select|Wrap|Line Numbers
  1. Public Sub CreateChart(ByVal viLabeledSeries As Integer, 
  2. ByVal viNonLabeledSeries As Integer, ByVal vsWorkbookName As String, 
  3. ByVal vsPopulationName As String, ByVal vsPrimaryAxisTitle As String, 
  4. ByVal vsSecondaryAxisTitle As String)
  5.     Dim i As Integer
  6.     Dim series As series
  7.     Dim sXColumn As String
  8.     Dim sYColumn As String
  9.  
  10.     'Create the chart
  11.     Charts.Add
  12.     ActiveChart.ChartType = xlXYScatter
  13.     ActiveChart.PlotBy = xlColumns
  14.  
  15.     For i = ActiveChart.SeriesCollection.Count To 1 Step -1
  16.         ActiveChart.SeriesCollection(i).Delete
  17.     Next i
  18.  
  19.     'Add the data series
  20.     For i = 1 To viNonLabeledSeries
  21.         sXColumn = GetColumnNameFromNumber((i - 1) * 2 + 4)
  22.         sYColumn = GetColumnNameFromNumber((i - 1) * 2 + 5)
  23.         Set series = ActiveChart.SeriesCollection.NewSeries
  24.         series.XValues = Sheets("Data").Range(sXColumn & "1:" & 
  25. sXColumn & "30000")
  26.         series.Values = Sheets("Data").Range(sYColumn & "1:" & 
  27. sYColumn & "30000")
  28.     Next i
  29.  
  30.     For i = 1 To viLabeledSeries
  31.         'Add the first data series because this way, the points will be on 
  32.         'top of the other points so it's easier to see them
  33.         Set series = ActiveChart.SeriesCollection.NewSeries
  34.         series.Name = Sheets("Data").Range("A" & i)
  35.         series.XValues = Sheets("Data").Range("B" & i & ":B" & i)
  36.         series.Values = Sheets("Data").Range("C" & i & ":C" & i)
  37.     Next i
  38.  
  39.  
  40.     ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="Chart"
  41.     ActiveChart.PlotArea.Select
  42.     Selection.ClearFormats
Mar 26 '09 #1
1 5586
kjb034
3 New Member
Ok, I figured out why Excel 2007 adds the lines.

I need to add the following code for each series created:

Expand|Select|Wrap|Line Numbers
  1. If Application.Version >= 12# Then
  2.     series.Format.Line.Visible = msoFalse
  3. End If
Mar 27 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

699
34287
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
9
12802
by: Dr. Colombes | last post by:
What is the easiest way to generate some plots and graphs in Python ? Specifically interested in simple histograms and scatter plots with circles and regression lines. Thanks for your suggestions.
0
4492
by: P Fu | last post by:
I am trying to plot pair using the XY scatter chart in Access and place it into a report. I want my x-axis to have "Age" values and the y-axis to have "Gross Area" values, both pulled using a query I created. Since the chart dialogue boxes only ask for the Y data series with an arbitrary X coordinate of 1, is there any way I can change that? That is, use the "age" values as the x-axis, not the arbitrary 1? Thanks for your help in...
7
23560
by: Newbie_sw2003 | last post by:
Where should I use them? I am giving you my understandings. Please correct me if I am wrong: MACRO: e.g.:#define ref-name 99 The code is substituted by the MACRO ref-name. So no overhead. Execution is faster. Where will it be stotred?(Is it in bss/stack/?) FUNCTION:
3
3485
by: Joe | last post by:
This probably isn't the right group for this kind of question but I figured I would take a shot... I want to remove points that skew a scatter plot. For example 20 data points are around -75 to 100 on the Y axis but a couple of points are at 1500 and a couple at -500 How would I figure which points should be removed? Of course I want to remove the 1500's and -500's.
0
1051
by: PremKumar | last post by:
I want to plot the lines in my form given only X and Y coordinates and I have to plot lines X and Y according to the given Surveyid.FOR ex:- x y Surveyid 10 10 5 12 12 5 17 17 5 27 27 5 31 31 5 33 33 14
8
30486
by: Derek Basch | last post by:
Can anyone give any suggestions on how to make a logarithmic (base 10) x and y axis (loglog) plot in matplotlib? The scatter function doesn't seem to have any log functionality built into it. Thanks, Derek Basch P.S. I suck at math so feel free to make me feel stupid if it is really easy to do :).
18
2712
by: DFS | last post by:
I posted this question yesterday, and nothing but silence. I looked through cdma in Google, and it seems whenever someone posts questions about scatter charts, they get ignored. So, hopefully, this time, someone will have some brilliant response to share. Starting with the Chart Wizard, I can't get the Access scatter chart to place the data points correctly, ie at the intersection of their XY
0
2355
by: derelict | last post by:
Hey all, im getting desperate now. I have a macro running in Word 2003, when I run the macro it *should* put a 'bottom' cell border in each cell that has the style used - this included a border at the top of the table and one at the bottom, like a set of container border for a table with no border within it. i.e table heading _______________________________ << top border text in the table spanning multiple rows and columns...
0
9715
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9595
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10099
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9176
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4314
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3836
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.