Unable to add value to cells in a "named" range in excel using VB.NET (what is wrong with this code?) -


i trying implement following loop not able name excel range.

dim oxl new excel.application       dim owb13 excel.workbook owb13 = oxl.workbooks.open("f:\mybook.xlsx")  owb13 = 1 2   .worksheets(i).range("n102:xfd102").name = "to_from"     owb13.worksheets(i)        j = 1 2         .range("to_from").cells(102, 13 + j).value = "k" & j        next     end next end  oxl.visible = true  

expected result: cells n102 , o103 in each worksheet in owb13 should have names/value k1 , k2 respectively.

what wrong here?

vb.net understanding: intermediate

thanks

i not sure trying do: result of code set cells sheet1!aa203:ab203 , sheet2!aa203:ab203 k1 , k2 , have single global defined name of 'to_from' referring sheet2!$n$102:$xfd$102

if want set values of n102 , o103
.range("to_from").cells(102, 13 + j).value = "k" & j should read
.range("to_from").cells(j, j).value = "k" & j
(the .cells reference within range)

but using global defined name amd redefining confusing @ best: why not use range address?
.range("n102:xfd102").cells(j, j).value = "k" & j


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -