4.20 FAQ-379 How to get the column name, units, etc.?

Last Update: 6/22/2022

Use the Column Label Row Characters. For example:

// Gets or sets the long name of first column in active sheet
col(1)[L]$ = ;

// Gets or sets the units of first column in active sheet
col(1)[U]$ = ;

// Gets or sets first Parameter row of first column in active sheet
col(1)[P1]$ = ; 

// Gets or sets first User Defined row of first column in active sheet
col(1)[D1]$ = ;

col() only accepts column name or index as arguments. Use wcol() if you need to use a term that evaluates to a column number. For example:

//Gets or sets the comments of the column with the short name 'ii' in active sheet
//Does not return the third column. 
ii=3;
col(ii)[C]$ = ;
//Gets or sets the F(x)= formula of the third column in the active sheet
ii=3;
wcol(ii)[O]$ = ;
//Loop through worksheet setting every even-numbered-column comment equal to the units of the column before it for the active sheet
nCols=wks.GetNumCols();
for (ii=0;ii<nCols;ii=ii+2){
wcol(2+ii)[C]$=wcol(1+ii)[U]$;
};
Note: These are string properties and need to be assigned to a string variable.

Keywords:header, labels