Create Multiple Charts w/ VB
I'd like to create a chart, many times over. My data is in XY format. Upon using the recording feature, it locks in a specific chart name, "Chart1"; and also, locks in a specific data range, "A1:F5". I was wanting to create this XY chart with A1:F5 for Chart1, then have it move down and grab A7:F11 for Chart2, and so on. I have about 100 or so data ranges to create that many charts. How can I make these references relative or unlock the specific cell address? Any help would be greatly appreciated. Thanks!, Kevin -- quickcreator |
Kevin -
You'll need something like this: Sub MakeCharts() Dim iChart as Long Dim wsData as Worksheet Set wsData = ActiveSheet For iChart = 1 to 100 With Charts.Add .SetSourceData _ Source:=wsData.Range("A1:F5").Offset((iChart - 1) * 6) .Name = "Chart" & Format(iChart, "000") End With Next End Sub - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ quickcreator wrote: I'd like to create a chart, many times over. My data is in XY format. Upon using the recording feature, it locks in a specific chart name, "Chart1"; and also, locks in a specific data range, "A1:F5". I was wanting to create this XY chart with A1:F5 for Chart1, then have it move down and grab A7:F11 for Chart2, and so on. I have about 100 or so data ranges to create that many charts. How can I make these references relative or unlock the specific cell address? Any help would be greatly appreciated. Thanks!, Kevin |
All times are GMT +1. The time now is 02:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com