Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
y y is offline
external usenet poster
 
Posts: 60
Default Macro to create large 2d surface charts.

Is there a macro to easily create 2D surface charts?
Where I may find it out?

I'm going to build it on my own, but if someone did it I'll actually appreciate his/her work! ;)
Any hints for the last questions?

Thanks, Alex.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro to create large 2d surface charts.

Turn on the macro recorder while you do it manually.

--
Regards,
Tom Ogilvy

"y" wrote in message ...
Is there a macro to easily create 2D surface charts?
Where I may find it out?

I'm going to build it on my own, but if someone did it I'll actually

appreciate his/her work! ;)
Any hints for the last questions?

Thanks, Alex.



  #3   Report Post  
Posted to microsoft.public.excel.programming
y y is offline
external usenet poster
 
Posts: 60
Default Macro to create large 2d surface charts.

Hi Tom,
I did it and tried to go over but not all things go fine...

This is the code:

Sub Crea2DChart()
Dim sArea As Range
Dim i As Integer
Dim Nseries As Integer
Set sArea = Application.InputBox(prompt:="Select range:", Type:=8)

Nseries = sArea.Rows - 1 << ??? run-time error 13 ???


Charts.Add
ActiveChart.ChartType = xlSurface
ActiveChart.SeriesCollection(1).XValues = sArea.Offset(sArea.Columns.Count, 2).Resize(1,
sArea.Columns.Count - 1)
For i = 1 To Nseries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(i).Values = ActiveSheet.sArea.Offset(i + 1, 2).Resize(1,
sArea.Columns.Count)
ActiveChart.SeriesCollection(i).Name = ActiveSheet.sArea.Offset(i + 1, 1).Resize(1, 1)
Next i
ActiveChart.Location Whe=xlLocationAsNewSheet
End Sub

Thanks, Alex

Tom Ogilvy wrote:

Turn on the macro recorder while you do it manually.


  #4   Report Post  
Posted to microsoft.public.excel.programming
y y is offline
external usenet poster
 
Posts: 60
Default Macro to create large 2d surface charts.

Hi Tom,
I did it and tried to go over but not all things go fine...

This is the code:

Sub Crea2DChart()
Dim sArea As Range
Dim i As Integer
Dim Nseries As Integer
Set sArea = Application.InputBox(prompt:="Select range:", Type:=8)
Nseries = sArea.Rows.count - 1
Charts.Add

ActiveChart.ChartType = xlSurface << ?? run-time error = 1004 ??


ActiveChart.SeriesCollection(1).XValues = sArea.Offset(sArea.Columns.Count, 2).Resize(1,
sArea.Columns.Count - 1)
For i = 1 To Nseries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(i).Values = ActiveSheet.sArea.Offset(i + 1, 2).Resize(1,
sArea.Columns.Count)
ActiveChart.SeriesCollection(i).Name = ActiveSheet.sArea.Offset(i + 1, 1).Resize(1, 1)
Next i
ActiveChart.Location Whe=xlLocationAsNewSheet
End Sub

Thanks, Alex

Tom Ogilvy wrote:

Turn on the macro recorder while you do it manually.



  #5   Report Post  
Posted to microsoft.public.excel.programming
y y is offline
external usenet poster
 
Posts: 60
Default Macro to create large 2d surface charts.

Hi Tom,
I did it and tried to go over but not all things go fine...

This is the code:

Sub Crea2DChart()
Dim sArea As Range
Dim i As Integer
Dim Nseries As Integer
Set sArea = Application.InputBox(prompt:="Select range:", Type:=8)
Nseries = sArea.Rows.count - 1
Charts.Add

ActiveChart.ChartType = xlSurface << ?? run-time error = 1004 ??

Do I need to activate it? And How?


ActiveChart.SeriesCollection(1).XValues = sArea.Offset(sArea.Columns.Count, 2).Resize(1,
sArea.Columns.Count - 1)
For i = 1 To Nseries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(i).Values = ActiveSheet.sArea.Offset(i + 1, 2).Resize(1,
sArea.Columns.Count)
ActiveChart.SeriesCollection(i).Name = ActiveSheet.sArea.Offset(i + 1, 1).Resize(1, 1)
Next i
ActiveChart.Location Whe=xlLocationAsNewSheet
End Sub

Thanks, Alex

Tom Ogilvy wrote:

Turn on the macro recorder while you do it manually.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default Macro to create large 2d surface charts.

Hi Alex,

I modify some of your code below with commentary. Please read!

'----------------------
Sub Crea2DChart()
Dim sArea As Range
Dim i As Integer
Dim Nseries As Integer
'Add the definition for the Chart object and SeriesCollection
Dim oChart As Excel.Chart
Dim oSC As Excel.SeriesCollection

Set sArea = Application.InputBox(prompt:="Select range:", Type:=8)

Nseries = sArea.Rows.Count - 1
'change the codes from
' Charts.Add
'to the line below which set the new created object to oChart variable
Set oChart = Charts.Add

'ActiveChart.ChartType = xlSurface
oChart.ChartType = xl3DArea
'select this chart object
oChart.Select

'at this time, there is empty in the series, you will need to
'add one range object or array to create series so that you can
' set value to the chart serie.
'See my code below
Set oSC = oChart.SeriesCollection
Call oSC.Add(sArea)

'then using oChart instead of ActiveChart in the later codes
'Please note: before using the chart serie, please ensure it exists in the chart
'...
'----------------------

Furthermore, "Quick Chart VBA Examples" from Jon will help you a lot on the chart development.
http://peltiertech.com/Excel/ChartsH...html#VBAcharts

Please feel free to let me know if you have any further questions.

Best Regards,
Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
---
This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft
does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any
representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of
any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any
software from the Internet.



  #7   Report Post  
Posted to microsoft.public.excel.programming
y y is offline
external usenet poster
 
Posts: 60
Default Macro to create large 2d surface charts.

Hi Wei-Dong XU,

the links you told me are very interesting. Thank you a lot!
Alex.


Furthermore, "Quick Chart VBA Examples" from Jon will help you a lot on the chart development.
http://peltiertech.com/Excel/ChartsH...html#VBAcharts

Please feel free to let me know if you have any further questions.


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default Macro to create large 2d surface charts.


You are welcome!

Best Regards,
Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


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
surface charts in 2-D Sarah Jurak Charts and Charting in Excel 2 December 30th 09 10:39 PM
Interval in legends in surface charts Lars Thomsen Nielsen Charts and Charting in Excel 8 December 7th 09 11:43 AM
scales on surface / contour charts Fubardave Charts and Charting in Excel 1 May 1st 09 01:02 PM
surface in radar charts in Excel elka Charts and Charting in Excel 2 May 10th 06 12:53 PM
How do I plot multiple 3D surface charts David in Jakarta Charts and Charting in Excel 1 February 13th 06 12:11 PM


All times are GMT +1. The time now is 10:29 AM.

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"