Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 183
Default selection of non consecutive ranges

I am trying to produce a graph after selecting titles in column H.
The problem is that the titles might not be consecutive ranges and of course
will vary according to the selection. So I want to keep it fully flexible.

For instance (H1:H3 and then H6:H8).
In the code below, although Selection.Count=6, it will graph only the first
block of cells selected (i.e H1:H3).
Any help fully appreciated. Thanks


Dim GraphTitle As Range
Set GraphTitle = Selection

ActiveSheet.ChartObjects(1).Activate

ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("Data"). _
Range(GraphTitle, GraphTitle.Offset(0, 11)), PlotBy:=xlRows


--
caroline
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default selection of non consecutive ranges

Can you graph the same range manually? If so, then turn on the macro
recorder while you do it. If not, then you probably won't be able to do it
with code either.

--
Regards,
Tom Ogilvy


"caroline" wrote in message
...
I am trying to produce a graph after selecting titles in column H.
The problem is that the titles might not be consecutive ranges and of
course
will vary according to the selection. So I want to keep it fully flexible.

For instance (H1:H3 and then H6:H8).
In the code below, although Selection.Count=6, it will graph only the
first
block of cells selected (i.e H1:H3).
Any help fully appreciated. Thanks


Dim GraphTitle As Range
Set GraphTitle = Selection

ActiveSheet.ChartObjects(1).Activate

ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("Data"). _
Range(GraphTitle, GraphTitle.Offset(0, 11)), PlotBy:=xlRows


--
caroline



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
Counting the Number of Consecutive Ranges allan2005CL Excel Worksheet Functions 0 August 22nd 10 08:46 PM
COUNTIF FOR NON-CONSECUTIVE RANGES Marty Excel Worksheet Functions 2 March 2nd 10 03:30 AM
Assigning consecutive date ranges Brooke Excel Worksheet Functions 8 July 27th 06 07:35 PM
Need help adjusting selection ranges havocdragon Excel Programming 3 November 15th 05 05:24 PM
Sort Macro: Utilizing ComboBox Selection for Key1 through 3 Ranges buddhapenguin Excel Discussion (Misc queries) 0 May 13th 05 03:01 PM


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