Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Using vba to generate xy scatter plots in excel

Hello. I was trying to use vba to generate some xy scatter plots. It seems
like a simple task, but I haven't been able to find much on it. Anyways, I
have one column of data which I want to be the x-values, and another column
of y-values. I want to set the y-axis to a logarithmic scale, and I want to
be able to specify the maximum and minimum x and y values. Any help would be
greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Using vba to generate xy scatter plots in excel

The quick start is to turn on the macro recorder and build your first chart
by hand. Make all appropriate settings. then turn off the macro recorder and
generalize the recorded macro to suit your needs.

General help can be found at:

http://peltiertech.com/

--
Regards,
Tom Ogilvy


"JacksonRJones" wrote:

Hello. I was trying to use vba to generate some xy scatter plots. It seems
like a simple task, but I haven't been able to find much on it. Anyways, I
have one column of data which I want to be the x-values, and another column
of y-values. I want to set the y-axis to a logarithmic scale, and I want to
be able to specify the maximum and minimum x and y values. Any help would be
greatly appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Using vba to generate xy scatter plots in excel

I tried doing that but didn't get very far. When I try to compile the code
from the macro recorder, I get an error "unable to set the values property of
the series class" I don't understand the syntax that's being used to assign
the x and y values. I tried changing it to the cells I wanted to plot, i.e.
J15:J1038, etc, and still get the same error. Thanks. Here's the recorded
macro:

Charts.Add
ActiveChart.ChartType = xlXYScatterSmooth
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = "=Sheet1!R15C10:R1038C10"
ActiveChart.SeriesCollection(1).Values = "=Sheet1!R15C14:R1038C14"
ActiveChart.Location Whe=xlLocationAsNewSheet, Name:="Aperture"
ActiveChart.Axes(xlValue).MajorGridlines.Select
With ActiveChart.Axes(xlValue)
.MinimumScale = 0.01
.MaximumScale = 1
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLogarithmic
.DisplayUnit = xlNone
End With
ActiveChart.Axes(xlCategory).Select
With ActiveChart.Axes(xlCategory)
.MinimumScale = -100
.MaximumScale = 100
.MinorUnitIsAuto = True
.MajorUnit = 20
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With

"Tom Ogilvy" wrote:

The quick start is to turn on the macro recorder and build your first chart
by hand. Make all appropriate settings. then turn off the macro recorder and
generalize the recorded macro to suit your needs.

General help can be found at:

http://peltiertech.com/

--
Regards,
Tom Ogilvy


"JacksonRJones" wrote:

Hello. I was trying to use vba to generate some xy scatter plots. It seems
like a simple task, but I haven't been able to find much on it. Anyways, I
have one column of data which I want to be the x-values, and another column
of y-values. I want to set the y-axis to a logarithmic scale, and I want to
be able to specify the maximum and minimum x and y values. Any help would be
greatly appreciated.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Using vba to generate xy scatter plots in excel

Nevermind.. I had accidentally deleted the columns I was trying to graph from
and that was causing the error. Thanks.

"Tom Ogilvy" wrote:

The quick start is to turn on the macro recorder and build your first chart
by hand. Make all appropriate settings. then turn off the macro recorder and
generalize the recorded macro to suit your needs.

General help can be found at:

http://peltiertech.com/

--
Regards,
Tom Ogilvy


"JacksonRJones" wrote:

Hello. I was trying to use vba to generate some xy scatter plots. It seems
like a simple task, but I haven't been able to find much on it. Anyways, I
have one column of data which I want to be the x-values, and another column
of y-values. I want to set the y-axis to a logarithmic scale, and I want to
be able to specify the maximum and minimum x and y values. Any help would be
greatly appreciated.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 crashing with simple scatter plots with 8 k data points Boris Charts and Charting in Excel 7 February 25th 10 01:55 AM
Excel 2007: Lines not displaying on Scatter Plots dyoung Charts and Charting in Excel 1 April 24th 09 01:54 AM
Excel 2007: Lines not displaying on Scatter Plots dyoung Charts and Charting in Excel 0 April 23rd 09 11:21 PM
Scatter plots in excel 2007 Rohini Gupta Charts and Charting in Excel 1 June 15th 08 09:18 PM
Excel gives me line plots - I want scatter plots Pangloss Charts and Charting in Excel 1 October 14th 05 02:15 PM


All times are GMT +1. The time now is 12:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"