Page 1 of 1

Import data into excel, error 1004

Posted: Fri Sep 06, 2019 8:30 am
by fake
Hello
I am not sure if this has already been answered. I recorded some data through the ios app.
Then I followed the steps to create the macro, as described on the webpage.
Then I imported the csv file from dropbox into excel using coma as the separator, so it was all aligned in different cells beautifully.
And when I then run the macro on it, I got the error message "Run-Time '1004' Method 'range' of object '_Global' failed."

What can I do to fix this?
Sorry I am not an experienced coder. I'm sure I've done something wrong. :) :?:

Re: Import data into excel, error 1004

Posted: Fri Sep 06, 2019 9:10 am
by James
If you're using an older version of Excel such as 2003 or Excel for Mac, you need to set the "OldExcel" variable to True on line 16 of the code.

Re: Import data into excel, error 1004

Posted: Fri Sep 06, 2019 11:03 am
by fake
I use Microsoft Office 365 ProPlus :) Sorry, forgot to mention this in my first post.

What I noticed is:
If I compare my excel, I have values like:
a.JPG
a.JPG (150.81 KiB) Viewed 16581 times
But mine looks like this:
c.JPG
c.JPG (81.04 KiB) Viewed 16581 times
"Timestamp" includes the date, not just the time.
And the values in the cells are different too.

I hope that helps to narrow down the issue.

Thx, fake

Re: Import data into excel, error 1004

Posted: Fri Sep 06, 2019 1:13 pm
by James
Mac or PC?
If you click in the timestamp field then you will see it contains a full date and time down to the millisecond.
If you change the number format for the timestamp column to "yyyy-mm-dd hh:mm:ss.000" you'll see the actual data in full. By Default Excel doesn't interpret it correctly and if you hit save, it'll mess it up, so make sure you are using a clean CSV that hasn't been edited when you run the macro.

To check, open it it notepad and check you have a full timestamp like "2019-09-06 14:27:56.798" in the data, or the script will fail.

If the script is still failing, give me a screenshot of where it's failing in the code.

Re: Import data into excel, error 1004

Posted: Sun Sep 08, 2019 8:29 am
by fake
ImageHi. Thank you so much for your help and your response.

I am working on windows. I checked the CSV file. The date seems fine: 2019-09-06 10:10:43.948

I imported to excel through Data> From CSV > here I selected "Coma" as the separator.

Here the 2 screens I made from the error / debug window.
d.JPG
d.JPG (22.98 KiB) Viewed 16574 times
e.JPG
e.JPG (169.4 KiB) Viewed 16574 times
And just in case, I also attached the 20 min recording, that I am trying to graph out.

:)

Kind regards, Olga

Re: Import data into excel, error 1004

Posted: Sun Sep 08, 2019 10:04 am
by James
The file works for me.
At this point in the script you should have a new tab called "GraphingDataAve" with a bunch of filtered data in.
You should have columns from A to AR.
This line of script is selecting the AM to AR columns to add the chart.

I suspect when you're opening the file with import, it's not importing properly. You should just be able to open the file directly into Excel without doing an import. Import is only really necessary if you have a non-English version of Excel and need to modify which characters are used for decimal separators and column separators.

If you do have a non-English version, then make sure you have the Decimal separator set to "." and the Thousands set to ",".
Also make sure if you're using the CSV import option to not set any data types. Make sure everything is type "General" then it will automatically figure it out.

Re: Import data into excel, error 1004

Posted: Wed Sep 11, 2019 5:22 am
by fake
Ah, that was the problem :)
Thank you. You're a genius :)