LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

writing to excel cell location that is changing

We currently have a program that is behaving in the manor that we want and displaying all necessary information on the Front panel using indicators.  However we need to get this information into Excel.  We seem to be having a problem defining the cell row and column location using a variable that changes throughout the program.
 
The program consists of a 3 while loops contained within each other.  Once a while loop is ended 1-2 pieces of data are to be exported.  We do not want the data to overwrite itself.  Here is an idea of what we are looking for. 
 Set 1            Set 2            Set 3          ....................
Exercise A   Weight 1      Weight 2      Weight 3     ....................
 Reps  1        Reps  2        Reps 3       ....................
 
Exercise B   Weight 4      Weight 5       ....................
 Reps 4          Reps 5        ....................
 
Exercise C   Weight 6       ....................
 Reps 6         .....................
:
:
:
:
 
The way that we have it programmed currently has outputs corresponding to what ideally would be the cell location. 
For instance, displays include Output, Cell Row, Cell Column.   (A1 = 0,0     A2 = 1,0     B1=0,1)
The above information is currently outputting
 
Output          Cell Row      Cell Column
Exercise 1     1                    0
Exercise 2     4                    0
Exercise 3     7                    0
Set 1              0                    1
Set 2              0                    2
Set 3              0                    3
Weight 1        1                    1
Weight 2        1                    2
Weight 3        1                    3
Weight 4        4                    1
Weight 5        4                    2
Weight 6        7                    1
Reps 1           2                    1
Reps 2           2                    2
Reps 3           2                    3
Reps 4           5                    1
Reps 5           5                    2
Reps 6           8                    1
 
The numbers that correspond to the row and column are from mathematically manipulating the i (counter) of the corresponding while loop.  The reps' loop is within the set's loop which is included within the exercise's loop.
We do not want to put a limit to the number of Exercises or Sets that are done.
 
Ideally it is as simple as hooking up the for each set of data and each variable to a function but we are overlooking it.
Is there anything that would look like this or do what this idea would indicate?
                                   __________
(Row Location)........|                   |
(Column Location)..|   Tool        |......<Excel File Location>
(Tab Location).........|  Function  |
(Data Importing)......|__________|
 
Where we could just hook up our wires containing this information we currently have displayed with indicators telling us esentially where the information should be going.
 
We are using Labview 7.1 and are working on trying to find the Report Generation Toolkit from our University's College of Engineering.
 
Any Ideas?
 
Thanks
0 Kudos
Message 1 of 4
(3,141 Views)
Attached is the code if more clarification is needed.
0 Kudos
Message 2 of 4
(3,135 Views)

Hi,

I had a look at your code and unfortunately it needs a lot of refactoring.  Please refactor your code.  In regards to your problem. I believe one good tool is the report generation toolkit, which has similar functionality to what you specify.  "Excel Insert Cells.vi" will insert a cell, row or column into the specified field. 

I hope this helps


Regards,

Nadim
Applications Engineering
National Instruments

 
0 Kudos
Message 3 of 4
(3,103 Views)
There is an example called Write Table to XL.vi that I think will help you out. It contains a VI called Set Cell Value.vi which contains a VI called Row Col to Range Format.vi. This VI takes a numeric row,col like 1,1 and converts it to an Excel range: A1. Copy both of these VIs to your project and use them to add a value to a cell like you want to. One caveat that you should take note of: rows and columns begin with index 1, so always increment the iterator in the loop if you use these VIs.
0 Kudos
Message 4 of 4
(3,097 Views)