LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help Arranging an Array of Data into an Excel Worksheet (using ActiveX)

Solved!
Go to solution

Hello!

So I have a 2D array of data that I pulled from a separate file and I am trying to arrange and put into a new file but I am running into an error using ActiveX when it comes to specifying the cells I want each bit of data to go into. I do not understand how the Worksheet Range property works when given an array of cell numbers with the 2D array of data I am using. I noticed that if I only give it one cell name, for example A2, it will put my very first piece of data into that cell, but I can't figure out how to get the rest of the data in. I inserted pictures of an example array of data I am trying to use as well as the snippet of the code that I have to accomplish this task. Essentially, I am just looking to take this data, swap some of the columns and then write that data into an excel file that already has headers and formatting done. I hope this is making sense, but any help is appreciated! Thanks!

Data.PNG

snippet.PNG

0 Kudos
Message 1 of 10
(3,589 Views)

You can write the string A2:E13 to the cell1 input.

 

Ben64

Message 2 of 10
(3,556 Views)

Thanks! I'll try that!

0 Kudos
Message 3 of 10
(3,511 Views)

I tried this and the data ended up repeating in each row...

data2.PNG

So I tried just deleting one column from the array of data and using that column of data I tried A2:A13, but it just placed the very first element of the array in each row. Any idea what's going on?

0 Kudos
Message 4 of 10
(3,507 Views)

There seems to be an issue with your data array since the repeating row is the first column of the array displayed in your first post. Why don't you post your vi with actual data saved as default value in your data array.

 

Ben64

Message 5 of 10
(3,501 Views)

Here is my VI I have been using. Right now I only have it extracting one column from the excel file and writing it to a new excel file, but the overall goal is to have it extract all the columns and place them in new columns in the new excel file as soon as I figure out why its not writing properly. I also included the excel file with my test data and the template I am using for the new excel file. Thanks for all the help!

Download All
0 Kudos
Message 6 of 10
(3,485 Views)

To begin with, it's a bad idea to open and close Excel for each file, it should be open once at the beginning and closed in the end. I have no idea how you ended up with repeated first line, maybe an effect of closing and reopening the application rapidly. I simplified your vi and it seems to work fine.

 

Ben64

Message 7 of 10
(3,481 Views)

Awesome! I'm new to ActiveX so I'm still learning the proper way to use it so thank you for all the help! Would you be able to back save the VI to LabView 2013 though? I can't open it because I don't have the latest version.

0 Kudos
Message 8 of 10
(3,477 Views)
Solution
Accepted by topic author ebohannon
Message 9 of 10
(3,474 Views)

Thanks so much for all the help! I really appreciate it!

0 Kudos
Message 10 of 10
(3,467 Views)