LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using vlookup btwn worksheets when using ActiveX Excel

I am having problems using the vlookup function in Excel.  It works fine if I have the lookup table on the same worksheet that's already open in LabVIEW.  I first open an excel file that I use as a template.  I copy the header and formula information from that file into an activeX container containing an Excel worksheet.  I then allow the analyst to enter data into the ActiveX Excel spreadsheet.  Meanwhile, I create a log template by creating a text file with headers.  When the analyst is done entering data on the front panel, they click on the Update/Print Label button.  This appends their data (a range of cells) to the text file (which is then formatted and saved using report generation tools) and it's printed to a label.  The problem is on the front panel ActiveX Excel sheet.  The original excel sheet used as a template has many formulas, all of which work well in Excel, as well as in the LabVIEW app, with one notable exception.  One of the cells contains a formula that uses a vlookup function.   

The problem is when I place that lookup table on a different worksheet.  It works great if I place the lookup table on the same sheet as the template, but when I try to reference a different sheet, I get an error.  I'm assuming that I just need to add code to open the second Excel spreadsheet (or better yet - a separate workBOOK).  I was confused at first, because the vlookup function worked fine in Excel, but not in LabVIEW.  Then I realized that Excel already had all the worksheets in the workbook open, but LabVIEW does not.  Am I correct?  If I want to use a vlookup to look on another worksheet or another workbook, do I just have to open that second workbook/sheet in LabVIEW?

0 Kudos
Message 1 of 2
(2,736 Views)

Hi Dan,

 

You are right.  LabVIEW does not have the other worksheets open.  I think that you are on the right track.  I recommend opening another worksheet and testing it out.  LabVIEW should stop giving you an error when you do.

 

 

Nick Keel

Applications Engineering

National Instruments 

Nick Keel
Product Manager - NI VeriStand and Model Interface Toolkit
National Instruments
0 Kudos
Message 2 of 2
(2,716 Views)