I have an excel spread sheet from which I must create graphs (XY scatter plots in this case)
I wish to create a macro to create the graphs as the data changes weekly and graphs of each set of data must be created.
Creating a macro to do this rather than having to manualy graph the data each week is not a problem.
My issue is that the amount of data in each column changes weekly, Column A is always the same parameter as is column B etc etc, however the length of the columns vary, this week all columns contain 22 entrys, this could be 50 or any other number next week.
Eg currently the macro will plot A1 to A22 against B1 to B22, if next weeks data sheet contains 50 values per column, the macro will plot A1 to A22 regardless and A23 to A50 will not appear on the graph.
I have attempted to use dynamic ranges do do this.
I've outlined my current method below, if you could spot where I'm going wrong or suggest an alternative method that would be a huge help.
Open worksheet of raw data, 1st 4 rows contain text, rows 5 to 26 contain numerical data.
Create 2 new sheets, name one graphs and one formatted data.
create macro / start recording.
insert scatter plot in "graphs" sheet, select data, plot A5:A26 on x axis against B5:B26 on y axis, format graph, axis lables etc
Paste raw data column by column into "formatted data" sheet under user friendly headings as headings in raw data sheet are obtained from a machine and its unclear what they represent.
stop recording and save.
test macro by adding data to each column so they span from A5:A50 instead of A5:A26 as before, this is scenario I need macro to deal with when completed, varying amounts of data processed in the same manor.
When I run the macro again with the additional data, the graph still only plots A5:A26 as before and the formatted data page contains only 1st 21 entries also.
I have tried seting the dynamic ranges both before and within the macro, neither case made a difference.
It is worth pointing out the data runs for 286 columns and is used to create 20 seperate graphs, I have only described A and B above for simplicity but I require the macro to work for the full volume of data.
Also the dates in the raw data shet are in the format 04-04-12-13_41 is there a way to convert all these entries to a better format, 04/April/12 13:41 or similar, and the data is recorded at 5 minute intervals and must be graphed as such, I have been writing a column of increments of 5 by using A1=0, A2=A1+5 and dragging this down to whatever length is needed and using this as the x axis for all the plots, this suffers the same problem however of not increasing when the amount of data increases.
Any help on any of these issues would be hugely appreciated!
Thanks for taking the time to read this!
I wish to create a macro to create the graphs as the data changes weekly and graphs of each set of data must be created.
Creating a macro to do this rather than having to manualy graph the data each week is not a problem.
My issue is that the amount of data in each column changes weekly, Column A is always the same parameter as is column B etc etc, however the length of the columns vary, this week all columns contain 22 entrys, this could be 50 or any other number next week.
Eg currently the macro will plot A1 to A22 against B1 to B22, if next weeks data sheet contains 50 values per column, the macro will plot A1 to A22 regardless and A23 to A50 will not appear on the graph.
I have attempted to use dynamic ranges do do this.
I've outlined my current method below, if you could spot where I'm going wrong or suggest an alternative method that would be a huge help.
Open worksheet of raw data, 1st 4 rows contain text, rows 5 to 26 contain numerical data.
Create 2 new sheets, name one graphs and one formatted data.
create macro / start recording.
insert scatter plot in "graphs" sheet, select data, plot A5:A26 on x axis against B5:B26 on y axis, format graph, axis lables etc
Paste raw data column by column into "formatted data" sheet under user friendly headings as headings in raw data sheet are obtained from a machine and its unclear what they represent.
stop recording and save.
test macro by adding data to each column so they span from A5:A50 instead of A5:A26 as before, this is scenario I need macro to deal with when completed, varying amounts of data processed in the same manor.
When I run the macro again with the additional data, the graph still only plots A5:A26 as before and the formatted data page contains only 1st 21 entries also.
I have tried seting the dynamic ranges both before and within the macro, neither case made a difference.
It is worth pointing out the data runs for 286 columns and is used to create 20 seperate graphs, I have only described A and B above for simplicity but I require the macro to work for the full volume of data.
Also the dates in the raw data shet are in the format 04-04-12-13_41 is there a way to convert all these entries to a better format, 04/April/12 13:41 or similar, and the data is recorded at 5 minute intervals and must be graphed as such, I have been writing a column of increments of 5 by using A1=0, A2=A1+5 and dragging this down to whatever length is needed and using this as the x axis for all the plots, this suffers the same problem however of not increasing when the amount of data increases.
Any help on any of these issues would be hugely appreciated!
Thanks for taking the time to read this!