Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Urgent, help needed on range selection!

Hi all!

I was trying to plot values for 2 variables as a XY scatter plot i
Excel, using Macros and recorded a macro while performing the abov
task.
The following is the macro I recorded.

Sub le( )

Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Sheets("Comparison of LE ti
distance"). _
Range("L6")
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = _
"='Comparison of LE tip distance'!R2C4:R102C4"
ActiveChart.SeriesCollection(1).Values = _
"='Comparison of LE tip distance'!R2C2:R102C2"
ActiveChart.Location Whe=xlLocationAsObject, Name:= _
"Comparison of LE tip distance"

End Sub


However, in this case since I manually selected the require
rows/columns for the graph, we can see that the cells ranging from
!R2C4:R102C4 were selected etc....
This might not be the general case. Hence I counted the no: of activ
rows and stored it into a variable called 'i'. I was wondering if ther
would be a way to select the cells like !R2C4:R"i"C4 instead o
!R2C4:R102C4, so that the code can be generalized.

I would appreciate your suggestions guys.
Thanks alot.

Arun.
Vtec Corp

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Urgent, help needed on range selection!

Sub le( )

Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Sheets("Comparison of LE tip
distance"). _
Range("L6")
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = _
"='Comparison of LE tip distance'!R2C4:R" & i & "C4"
ActiveChart.SeriesCollection(1).Values = _
"='Comparison of LE tip distance'!R2C2:R" & i & "C2"
ActiveChart.Location Whe=xlLocationAsObject, Name:= _
"Comparison of LE tip distance"

End Sub

--
Regards,
Tom Ogilvy

"aiyer " wrote in message
...
Hi all!

I was trying to plot values for 2 variables as a XY scatter plot in
Excel, using Macros and recorded a macro while performing the above
task.
The following is the macro I recorded.

Sub le( )

Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Sheets("Comparison of LE tip
distance"). _
Range("L6")
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = _
"='Comparison of LE tip distance'!R2C4:R102C4"
ActiveChart.SeriesCollection(1).Values = _
"='Comparison of LE tip distance'!R2C2:R102C2"
ActiveChart.Location Whe=xlLocationAsObject, Name:= _
"Comparison of LE tip distance"

End Sub


However, in this case since I manually selected the required
rows/columns for the graph, we can see that the cells ranging from
!R2C4:R102C4 were selected etc....
This might not be the general case. Hence I counted the no: of active
rows and stored it into a variable called 'i'. I was wondering if there
would be a way to select the cells like !R2C4:R"i"C4 instead of
!R2C4:R102C4, so that the code can be generalized.

I would appreciate your suggestions guys.
Thanks alot.

Arun.
Vtec Corp.


---
Message posted from http://www.ExcelForum.com/



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
Urgent help needed please Bob Newman Excel Discussion (Misc queries) 5 January 15th 09 03:24 AM
Urgent Help Needed please barkiny Excel Worksheet Functions 3 May 8th 06 04:36 PM
Urgent Help needed Brento Excel Discussion (Misc queries) 0 February 9th 06 09:10 PM
Urgent help needed sp123 Excel Worksheet Functions 1 February 7th 06 01:00 AM
Urgent Help needed ! sameer27p[_10_] Excel Programming 2 July 20th 04 09:06 PM


All times are GMT +1. The time now is 05:23 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"