Author |
Topic |
|
annniia
United Kingdom
2 Posts |
Posted - 08/27/2017 : 12:19:25 PM
|
Hi,
I have been trying to ease my data analysis with labtalk but so far unsuccesfully. My datasets (about 150 of them) contain X_i, Y_i columns, about 35 of each. There are some X_i columns missing and I can't use the option to skip, because those missing columns are random between datasets. I would like to delete all columns which long name starts with X, except X_0, and I would like to apply this to a few datasets (sheets) at a time.
I already played with the option to set a range that includes several X_i columns but for the amount of data I would be doing that until Christmas
Here is what a dataset looks like:
Thanks in advance! |
|
nick_n
Finland
125 Posts |
Posted - 08/27/2017 : 5:57:05 PM
|
Hi, Just copy that in Script Window (Alt+Shift+3). Change strArgument and strArgumentExclud as you wish. That LT will loop all pages and columns in current book. Best regards
string strArgument$="X*"; string strArgumentExclud$="X_0"; int ii, jj;
loop (jj, 1, page.nLayers) { page.active=jj; worksheet -s;
loop (ii, 1, wks.nCols) {
strColLabelName$=wcol(ii)[L]$; if (strColLabelName.match(strArgument$) && !strColLabelName.matchstrArgumentExclud$)) wks.colSel(ii, 1); } domenu 36442;
}
Nikolay |
|
|
nick_n
Finland
125 Posts |
Posted - 08/27/2017 : 6:00:01 PM
|
oops, One bracket is missing, check this line:
if (strColLabelName.match(strArgument$) && !strColLabelName.match(strArgumentExclud$))
Nikolay |
|
|
annniia
United Kingdom
2 Posts |
Posted - 08/28/2017 : 3:36:42 PM
|
Works perfectly! Thank you so much! |
|
|
|
Topic |
|
|
|