Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 5
Default Urgent help regarding line chart thru Excel-VBA

Hi All

I'm a newbie to the Excel-VBA .I need a code for my requirement and the
requirement is

if have three arrays

one array---random dates in a year say 2006

second array---random numbers between 1 and 50

third array--random numbers between 5 and 100

All the array sizes are of same length that is all of the three have
same upper bounds

now i need to generate an excel line chart programmatically such that

it contains one X-axis and two Y-axis(one on left and one on right)

pictorially graph should look like below

| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|---------------------------------------------------------|

one array should be plotted on X-axis
second array on left Y-axis
third array on right Y-axis

Please help...

Thanks & Regards
Kalyan Kamesh

  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 1,071
Default Urgent help regarding line chart thru Excel-VBA

Transfer the data from the three arrays into three columns using syntax
similar to (the untested)

range("a1").resize(ubound(arr1)-lbound(arr1)+1,1).value= _
application.worksheetfunction.transpose(arr1)

To get the code for the rest, turn on the macro recorder (Tools | Macro
Record new macro...), do the following by hand, turn off the recorder,
switch to the VBE and, if necessary, customize/generalize the XL-generated
code.
Click anywhere inside the the three columns then use the Chart Wizard to
create the chart. Once that's done, move one of the series to the secondary
axis. To do so, double-click the plotted series, then from the Axes tab
select 'Secondary'.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article .com,
says...
Hi All

I'm a newbie to the Excel-VBA .I need a code for my requirement and the
requirement is

if have three arrays

one array---random dates in a year say 2006

second array---random numbers between 1 and 50

third array--random numbers between 5 and 100

All the array sizes are of same length that is all of the three have
same upper bounds

now i need to generate an excel line chart programmatically such that

it contains one X-axis and two Y-axis(one on left and one on right)

pictorially graph should look like below

| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|---------------------------------------------------------|

one array should be plotted on X-axis
second array on left Y-axis
third array on right Y-axis

Please help...

Thanks & Regards
Kalyan Kamesh


  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 5
Default Urgent help regarding line chart thru Excel-VBA

Hi Tushar

I want all this process to be done programmatically...hope you
understand...

Regards
Kalyan


Tushar Mehta wrote:
Transfer the data from the three arrays into three columns using syntax
similar to (the untested)

range("a1").resize(ubound(arr1)-lbound(arr1)+1,1).value= _
application.worksheetfunction.transpose(arr1)

To get the code for the rest, turn on the macro recorder (Tools | Macro
Record new macro...), do the following by hand, turn off the recorder,
switch to the VBE and, if necessary, customize/generalize the XL-generated
code.
Click anywhere inside the the three columns then use the Chart Wizard to
create the chart. Once that's done, move one of the series to the secondary
axis. To do so, double-click the plotted series, then from the Axes tab
select 'Secondary'.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article .com,
says...
Hi All

I'm a newbie to the Excel-VBA .I need a code for my requirement and the
requirement is

if have three arrays

one array---random dates in a year say 2006

second array---random numbers between 1 and 50

third array--random numbers between 5 and 100

All the array sizes are of same length that is all of the three have
same upper bounds

now i need to generate an excel line chart programmatically such that

it contains one X-axis and two Y-axis(one on left and one on right)

pictorially graph should look like below

| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|---------------------------------------------------------|

one array should be plotted on X-axis
second array on left Y-axis
third array on right Y-axis

Please help...

Thanks & Regards
Kalyan Kamesh



  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 1,071
Default Urgent help regarding line chart thru Excel-VBA

In article .com,
says...
Hi Tushar

I want all this process to be done programmatically...hope you
understand...

Yes, and I told you how to get XL to generate the code for you!

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
  #5   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 5
Default Urgent help regarding line chart thru Excel-VBA

Hi Tushar

I have worked out in the way which u have specified me earlier..but in
that process the excel is generating a chart as a sheet...but i do
require a chart that is embedded in the sheet..so i have modified the
code as below


With ActiveSheet.ChartObjects.Add _ (Left:=100, Width:=375, Top:=970,
Height:=225) With .Chart .ChartType = xlLineMarkers .SetSourceData
Source:=Sheets("Sheet3".Range("A1:C28", PlotBy _ :=xlColumns
..Parent.Name = "Name of this Chart" End With End With

but the problem is i'm not getting dual Y-Axis
can u help me...

Thanks & Regards
Kalyan Kamesh

Tushar Mehta wrote:
In article .com,
says...
Hi Tushar

I want all this process to be done programmatically...hope you
understand...

Yes, and I told you how to get XL to generate the code for you!

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions




  #6   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 6,582
Default Urgent help regarding line chart thru Excel-VBA

You need to tell Excel to plot one series on the secondary axes:

ActiveChart.SeriesCollection(2).AxisGroup = xlSecondary

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"kalyan" wrote in message
oups.com...
Hi Tushar

I have worked out in the way which u have specified me earlier..but in
that process the excel is generating a chart as a sheet...but i do
require a chart that is embedded in the sheet..so i have modified the
code as below


With ActiveSheet.ChartObjects.Add _ (Left:=100, Width:=375, Top:=970,
Height:=225) With .Chart .ChartType = xlLineMarkers .SetSourceData
Source:=Sheets("Sheet3".Range("A1:C28", PlotBy _ :=xlColumns
.Parent.Name = "Name of this Chart" End With End With

but the problem is i'm not getting dual Y-Axis
can u help me...

Thanks & Regards
Kalyan Kamesh

Tushar Mehta wrote:
In article .com,
says...
Hi Tushar

I want all this process to be done programmatically...hope you
understand...

Yes, and I told you how to get XL to generate the code for you!

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions




  #7   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 5
Default Urgent help regarding line chart thru Excel-VBA

Thanks Jon that worked great

Thanks & Regards
Kalyan Kamesh


Jon Peltier wrote:
You need to tell Excel to plot one series on the secondary axes:

ActiveChart.SeriesCollection(2).AxisGroup = xlSecondary

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"kalyan" wrote in message
oups.com...
Hi Tushar

I have worked out in the way which u have specified me earlier..but in
that process the excel is generating a chart as a sheet...but i do
require a chart that is embedded in the sheet..so i have modified the
code as below


With ActiveSheet.ChartObjects.Add _ (Left:=100, Width:=375, Top:=970,
Height:=225) With .Chart .ChartType = xlLineMarkers .SetSourceData
Source:=Sheets("Sheet3".Range("A1:C28", PlotBy _ :=xlColumns
.Parent.Name = "Name of this Chart" End With End With

but the problem is i'm not getting dual Y-Axis
can u help me...

Thanks & Regards
Kalyan Kamesh

Tushar Mehta wrote:
In article .com,
says...
Hi Tushar

I want all this process to be done programmatically...hope you
understand...

Yes, and I told you how to get XL to generate the code for you!

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions



  #8   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 51
Default Urgent help regarding line chart thru Excel-VBA

kalyan wrote:

No problem and no code needed.



Select the second array -- choose "axis" and check
[]plot the array on the secondary axis

To begin, I assume you are doing a scatterplot, maybe with lines


Hi All

I'm a newbie to the Excel-VBA .I need a code for my requirement and the
requirement is

if have three arrays

one array---random dates in a year say 2006

second array---random numbers between 1 and 50

third array--random numbers between 5 and 100

All the array sizes are of same length that is all of the three have
same upper bounds

now i need to generate an excel line chart programmatically such that

it contains one X-axis and two Y-axis(one on left and one on right)

pictorially graph should look like below

| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|---------------------------------------------------------|

one array should be plotted on X-axis
second array on left Y-axis
third array on right Y-axis

Please help...

Thanks & Regards
Kalyan Kamesh

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
Data showing incorrectly on line chart gobonniego Charts and Charting in Excel 1 June 15th 06 07:56 PM
how to change line spacing for text box in excel chart Anne Charts and Charting in Excel 1 October 5th 05 12:11 AM
How to create a line chart with two X-axes in Excel JaVaughn Excel Discussion (Misc queries) 2 June 29th 05 04:52 PM
Urgent Chart Assistance Brent E Charts and Charting in Excel 1 May 10th 05 09:09 AM
Line chart - date line association gone mad! Johannes Czernin Charts and Charting in Excel 5 January 17th 05 08:48 PM


All times are GMT +1. The time now is 06:41 PM.

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

About Us

"It's about Microsoft Excel"