April 2006
Beginner
1114 pages
98h 16m
English
workbook.AcceptLabelsInFormulas [= setting]
True allows formulas to include range labels as if they were named ranges; False disables the use of labels in formulas. Default is True.
The following code creates some column headings and then makes those headings usable as labels in formulas that display the sum of each column:
' Create two column headings. [a1] = "col1": [b1] = "col2" ' Add some data. [a2] = 2: [a3] = 10: [a4] = 12: [a5] = 5 [b2] = 9: [a3] = 17: [b4] = 2: [b5] = 13: [b6] = 29 ' Allow labels in formulas. ThisWorkbook.AcceptLabelsInFormulas = True ' Create labels out of the column headings. [a1:b1].FormulaLabel = xlColumnLabels ' Use the labels in formulas [c1] = "=sum(col1)" [c2] = "=sum(col2)"
If you set AcceptLabelsInFormulas to False in the preceding code, C1 and C2 display an error.
Read now
Unlock full access