PDA

View Full Version : VBA: Macro for multiple charts creation with predefined settings



motozord
10-03-2015, 03:03 PM
Hi,

I'm new here, so hello everybody!

I've been struggling with a problem in my work since last year. The problem seems not to be so hard to solve as far as I keep an idea and algorithm in my mind. So here's what exactly I'm trying to achieve:

1. Data is stored in a sheet in following format:

14494

2. I expect from VBA macro to do a following thing:

Generate as many separate charts with a single sensor as number of sensors stored in data sheet. I have over 300 sensors which means over 300 columns. I'd like to make it automated. Sometimes I'll need change number of sensors (columns) when a new sensor will appear in data sheet.

Speaking about a chart it should be simple XY graph with a title = sensor 1, next title = sensor 2, etc.

I make a macro which generates simple but proper chart, but I did a manual thing to automate it - just have copied macro in a module changing chart range - but I feel it's stupid.

Regards,
M.

p45cal
10-03-2015, 04:21 PM
Would the attached do?
No macro but a dynamic range adjusted by the scroll bar beneath the chart.
Later you could add another scroll bar or two to add perhaps 1 or two more plots on the same chart for comparison of any sensors you want.

motozord
10-14-2015, 11:31 AM
It didn't solve my problem. I need separate charts up to number of sensors generated automatically based on data sheet (btw. charts named the same as sensors). An example below:

p45cal
10-14-2015, 03:10 PM
try the attached.