![]() |
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 |
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 |
All times are GMT +1. The time now is 08:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com