Note that there are some explanatory texts on larger screens.

plurals
  1. POExcel VBA: how to check for calculated column?
    primarykey
    data
    text
    <p>Is there anyway to check in VBA if a specific column of a table (ListObject) in Excel is a calculated column (as in <a href="http://office.microsoft.com/en-us/excel-help/use-calculated-columns-in-an-excel-table-HA010342380.aspx" rel="nofollow">http://office.microsoft.com/en-us/excel-help/use-calculated-columns-in-an-excel-table-HA010342380.aspx</a>)?</p> <p>Note that calculated columns will not only have the same R1C1 formula set for each row, but will also auto-expand when new rows are added (it will even repopulate if you delete the entire data body range and then recreate some new rows). So checking for columns with consistent formulas is not the same as checking for a calculated formula.</p> <p>It's even possible for a column to be calculated, but to have one of the rows overwritten with some other formula or value, and have the auto-expand features persist. </p> <p>So I'm pretty convinced this has to be some property of the column, I'm just not sure where I can access it through VBA. If it's not exposed through the VBA object model, is there some workarround to get this info?</p> <p>Thanks in advance, Carlos</p> <p>EDIT: I did some digging on the Excel Office Open XML files, and it turns out that what I'm looking for is the <code>&lt;calculatedColumnFormula&gt;</code> element on the <code>&lt;tableColumn&gt;</code> definition of the xl\tables\table*.xml files. Is there any way to get to that through VBA?</p> <p>EDIT2: Here is an <a href="http://dl.dropbox.com/u/68744475/calculated%20column%20examples.xlsx" rel="nofollow">example file</a> with the test cases that I could come up with. The VBA should signal that columns 1, 2 and 3 are calculated columns, and columns 4 and 5 aren't.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload