Add variable in formula

Hi all, I have this

datatablevariable.Rows(0).Item(“L12”).ToString

and i want to apply the variable at place of L12 so how will i do that.Help

Assign L12 to a variable, strVar = L12

datatablevariable.Rows(0).Item(strVar).ToString

I know this but this give error when i print it in message box
by using this i want to get value of excel

What is the error message?

not an error message i want value using above formula.

and it print
formula with variable value that i passed into it

Please try this -

strVar is the ColumnName

dataTable.Rows.Item(0).Item(strVar).ToString

this is what i got

Can I know what is L12.
Is there any column name with L12.

Hey @Sandeep_Kumar2

you are using t1.Rows(1).item(counter).ToString and here counter seems to me an Int32 Datatype?

if it is so it won’t work if you really want to access Row first and a particular column inside that Row then use t1.Rows(1)(counter).ToString

Regards…!!
Aksh