I'm just trying to use the SETVAL function in Excel, but I can't find the way to set the value to a variable with subscripts.
I'm using the SETVAL like in this example:
For x = 1 To 40
ro = x + 3
num$ = Worksheets("Sheet1").Cells(ro, 40).Value
con$ = x
comstr$ = "SIMULATE>SETVAL|vd[l" + con$ + "] = " + num$
result = vensim_command(comstr$)
If result = 0 Then Exit Sub
Next
Name of the subscripts: l1,l2,l3,l4,l5...
Name of the variable: vd.
I read in the manual that you need to surround the command in double quotes " ", but I don't understand.
The problem was after I set the initial values. I was trying to get the value of a constant, with the vensim_get_data, I just get another variable (level) and it work's fine.