From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing to an Excel named set

I have a VI that writes to Excel. It will write to a specific named range, or any range for that matter. My problem comes in the way it does this. If my named range has 8 rows in it, and I only have 6 rows to write (or any other number less than 8 greater than 1) it fills the rest of the range out with #N/A (will also do this for any columns not filled, but all necessary columns get filled in my program). Also when I write just one row of data it essentially copies the row into every row of the range, so I'd have 8 copies of the data for row 1. Anyone else run into something similar to this? Any ideas on how to fix it?
0 Kudos
Message 1 of 4
(2,341 Views)
I don't really do any work with excel, but the obvious workaround would be to check for these conditions and, if necessary, add empty rows to your set before sending it to excel. That should, presumably, cause these rows to be empty.

___________________
Try to take over the world!
Message 2 of 4
(2,333 Views)
Gary - did you ever get a solution to this? I refer to it as an Excel Named Range - seems like a real shame not to have this capability...

paul

Paul Anderson
paulofelora@yahoo.com
0 Kudos
Message 3 of 4
(2,265 Views)


@Elora_Paul wrote:
Gary - did you ever get a solution to this? I refer to it as an Excel Named Range - seems like a real shame not to have this capability...

paul

Paul Anderson
paulofelora@yahoo.com


IIRC, I padded the rest with blank strings to get my desired effect. Kinda cheating but oh well. I did later find out a different way to do this but it has to do with changes in Excel, not LabVIEW. You can create dynamic named ranges that change size based on how many items are in the rows/columns. Here's a link to how to change the range formula: http://www.ozgrid.com/Excel/DynamicRanges.htm

Hope that helps.
0 Kudos
Message 4 of 4
(2,255 Views)