I'm trying to allow a user to enter a list of columns, and then the script
makes an adjacent column and fills it with error data...here's the relevant code
[ %n = name of a column from the users list ]
/* find the column name in the list */
j=1;
colnum = -1;
for (j=1; j <= wks.nCols ; j+=1) {
wks.col = j;
%g=wks.col.name$;
type %n %g $(j);
if(%n==%g) {
colnum = j;
type (^^);
};
When I run this on worksheet with cols A B C D, i see:
(When %n="B")
B A 1
B B 2
^^
B C 3
B D 4
B E 5
(then the script adds column B2 and tries to find column C)
C A 1
C B 2
C B2 3
C C 4
^^
C D 5
C E 6
^^
(So the script adds a column C2 where it made the last match, ie at the end
then tries to find column D)
D A 1
^^
D B 2
D B2 3
^^
D C 4
D D 5
^^
D E 6
D C2 7
^^
So the comparison %n==%g is generating false positives. I've "typed" the
variables it looks at, so I don't understand what's going on...
I'd appreciate any help...