Import data into excel, error 1004

Post Reply
fake
Posts: 4
Joined: Fri Sep 06, 2019 8:25 am

Import data into excel, error 1004

Post 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. :) :?:
User avatar
James
Site Admin
Posts: 1110
Joined: Wed Jan 02, 2013 9:06 pm

Re: Import data into excel, error 1004

Post 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.
fake
Posts: 4
Joined: Fri Sep 06, 2019 8:25 am

Re: Import data into excel, error 1004

Post 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 16756 times
But mine looks like this:
c.JPG
c.JPG (81.04 KiB) Viewed 16756 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
User avatar
James
Site Admin
Posts: 1110
Joined: Wed Jan 02, 2013 9:06 pm

Re: Import data into excel, error 1004

Post 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.
fake
Posts: 4
Joined: Fri Sep 06, 2019 8:25 am

Re: Import data into excel, error 1004

Post 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 16749 times
e.JPG
e.JPG (169.4 KiB) Viewed 16749 times
And just in case, I also attached the 20 min recording, that I am trying to graph out.

:)

Kind regards, Olga
Attachments
museMonitor_2019-09-03--08-28-57.rar
(211.41 KiB) Downloaded 444 times
User avatar
James
Site Admin
Posts: 1110
Joined: Wed Jan 02, 2013 9:06 pm

Re: Import data into excel, error 1004

Post 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.
fake
Posts: 4
Joined: Fri Sep 06, 2019 8:25 am

Re: Import data into excel, error 1004

Post by fake »

Ah, that was the problem :)
Thank you. You're a genius :)
Post Reply