Nowadays structured references are the preferred way to access table data in Excel and VBA. Although most of the examples you may have looked at so far have talked about ranges, you can also specify table references to cDataSet – this allows you to mix cDataSet integration capabilities with other code you may have written which uses structured table references.
Populating a dataset
You already have the ability to refer to data by it’s column name in cDataSet ( ds.row(“x”).column(“y”) ), so the only real integration with tables that is needed is to be able to use a reference to load them to a cdataset initially.
Normally, you would populate a dataset with
where sheetName is the name of the worksheet with the table data, and populateData would figure out the rest.
However, it’s not widely known that you can also use a range so that your table data can still be used regardless of where it is on the sheet
To load data into cDataSet from a structure table, you can first get its range with the function getTableRange (tableName), and simply pass that over
here’s an example of a few operations where a data table is used to specify the input to cDataSet