How can AMPL manage with Dynamic Range in Excel

34 views
Skip to first unread message

Martin Bourdon

unread,
Jun 26, 2015, 12:58:45 PM6/26/15
to am...@googlegroups.com
Hi, 

I want to read a table from an excel file that have a dynamic lenght. When I just select a larger range than my table I get the error Duplicate [missing].. So I need to have the exact range size in excel. The only way I found was to call an offset function but then the value into the range is (...) so ampl can't see my table no more. 
Anyone have a hint on how can I call a dynamic range or VBA code that can name the range that I would be able to see from a spreadsheet not only in VBA. 

Thanx

Martin 

victor.z...@gmail.com

unread,
Jul 1, 2015, 11:15:57 AM7/1/15
to am...@googlegroups.com
Excel doesn't seem to expose dynamic ranges via ODBC, so you can't access them from AMPL via the ODBC table handler. However, you can define a range dynamically using VBA, for example:

  Worksheets("sheet1").Range("A1:A10").Name = "test"

which will be accessible by the ODBC table handler.

HTH,
Victor

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at http://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages