DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

2D Table Extract Cell Value

In a 2D table is there a way to extract the value or text that has been entered in a specific cell? I'm doing this to look up a value that has been entered by hand and then I will conditionally format based on that value.

 

I have tried the following and got an error that says this is not supported:

 

Target_Value=Report.Sheets("TestSheet").Objects("2DTable1").Columns.Item(1).TextList.Item(1)

0 Kudos
Message 1 of 4
(2,567 Views)

Hi BrianCT,

 

It's hard to make a recommendation for next steps without background information about your 2D table and what it contains. Could you post your TestSheet so we can see what data types you're working with?

Off the top of my head, it looks to me like you specified a column but not a row.

NickelsAndDimes
Product Support Engineer - sbRIO
National Instruments
0 Kudos
Message 2 of 4
(2,538 Views)

I can not post the actual 2D table here, company security. The table text is made up of numbers.

 

I was under the impression that the item(#) would refer to a row.

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

Hi Brian,

 

First off, I'd recommend you break down those object levels into separate commands and object variable assignments.  It's vastly better for debugging, and you often end up using the intermediate objects more than once, which makes it more convenient also and less tedious to type and read.

Set Sheet = Report.Sheets("TestSheet")
Set Table = Sheet.Objects("2DTable1")
Set Column = Table.Columns(1)
Set TextList = Column.TextList(1)
Target_Value = TextList.Text

The actual point you were missing in that super long command line was that the TextList is an object which has the property TextList.Text.  Once you add on ".txt", your old code should probably work.  Of course if it doesn't, good luck figuring out why with one long command line traversing the whole object tree...

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 4 of 4
(2,467 Views)