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: 

assign value to cell name in excel?

Hi,

 

I'm working with excel where I open a worksheet and assign a value to a specific cell. If I want to change the location of my data on the sheet, I need to reassign the values to new cells. However, If I assign values to a cell name, it would make it lost easier for me to rearrange my sheet and I wouldn't have to change my labview code.

I don't have the report generation toolkit. How would I achieve this?

thank you for any help!

 

Don't think twice.
0 Kudos
Message 1 of 4
(2,722 Views)

Hey,

 

So are you wanting to be able to specify the cell name (like A5), and then pass values to it? Here is a community example that mostly achieves this:  

 

https://decibel.ni.com/content/docs/DOC-2081

 

This example writes to the active cell that the user chooses. If this is not the exact functionality you are looking for, you can at least see how to use ActiveX to control different aspects excel and tweak the program to your needs. I hope this helps!

 

-Nathan H

Software Developer
National Instruments
0 Kudos
Message 2 of 4
(2,696 Views)

If you have supplied custom names to certain cells you can feed those names into the Range method and it will work.  If you have named ranges you can use item(get) and item(put) to feed values into the proper cell.  Remember that the index starts at 1.

 

I have only done this a few times, so I am by no means an Excel expert.

0 Kudos
Message 3 of 4
(2,690 Views)

thanks for advice. I did try to feed in the names directly into the range method but I must been missing something because it gave me an error. I'll try again and we'll see :).  

Don't think twice.
0 Kudos
Message 4 of 4
(2,681 Views)