PDA

View Full Version : [SOLVED] Macro recording gives different result in graph



paco
08-14-2014, 01:24 PM
HI,

Simple problem... :-)
I have a file that contains two collums.
I need to graph the first A collum "mm" to the second B collum "Force" from cell 13 downwards.

I import the file and recorded a macro for creating the graph.

I adapted the macro to run it all automaticly.

But the recorded part of the graph does not what I want it makes an other graph. wrong.jpg


if I manualy create from the same data a graph it works fine. correct.jpg

What do I do wrong?

As the file size is dynamic I also need to make variable to it accepts not fixed number of cells but looks if cell is filled and create the graph according to the filled cell when the data is imported.

Any help in the right direction would be appriciated.

paco
08-14-2014, 01:25 PM
I try to post the code but I get this

Post denied. New posts are limited by number of URLs it may contain and checked if it doesn't contain forbidden words.

Paco

Aussiebear
08-14-2014, 01:45 PM
Try attaching a workbook with the code, by clicking on the Go Advanced button, then scroll down to manage attachments and follow the prompts from there. I'm very confident we can arrive at a solution for you

paco
08-14-2014, 01:59 PM
Thanks for the advice.

I attached it as macro xlsm

paco
08-14-2014, 02:05 PM
One of the files to import. Sorry had to zip it as txt is not accepted........

paco
08-16-2014, 06:21 AM
OK, I am one step further.
Can import the file and select the dynamic entries in collum A and B using Lastrow.
I know this is not 100% dynamic but it is a start :-)

However I keep getting the same two series graph when I automaticly let the macro run.
Regardless if I use xlXYScatterSmoothNoMarkers or xlLine I still get the same graph (see previous wrong.jpg)
Again by manual selecting the graph I get the correct one.
New workbook is attached and will run by importing the .txt file.

Any help would be appriciated.

Paco

paco
08-17-2014, 04:50 AM
Solved.

Switching two lines did the trick.

Ammended file attached.