Technical support and scripting issues
Moderators: JRL, Dorian (MJT support)
-
carkon
- Newbie
- Posts: 13
- Joined: Sun Sep 26, 2010 9:36 am
Post
by carkon » Wed Jun 15, 2011 10:27 am
hi everbody i want to compare 2 number groups ..One of these number is in excel ,the other one is on the notepad.
firstly, 1 is will be compare with all C column and than if it is matched it will be delete this row.i mean this
1 compare with 45
1 compare with 34
1 compare with 23
1 compare with 78
1 compare with 32
1 compare with 16
1 compare with 98
1 compare with 26
1 compare with 15 nothing matched and nothing will be delete.and than 2
2 compare with 45
2 compare with 34
2 compare with 23
2 compare with 78
2 compare with 32
2 compare with 16
2 compare with 98
2 compare with 26
2 compare with 15 again nothing..when it came to 78 on notepad..as you see C4 will be matched and it will be delete ROW 4 (gala,4,78)
how can ý do this ? i try some scripts but they dont works
-
adroege
- Automation Wizard
- Posts: 438
- Joined: Tue Dec 07, 2004 7:39 pm
Post
by adroege » Wed Jun 15, 2011 5:03 pm
This should get you going in the right direction.
Code: Select all
//Open Excel
XLOpen>s:\xfer\alan\compare.xls,0,xlBook
XLGetSheetDims>xlBook,Sheet1,maxrows,maxcols
//Read notepad file
Let>k=1
Label>start
ReadLn>c:\temp\test.txt,k,line
If>line=##EOF##,finish
Gosub>SearchExcel
If>foundit=1
//only uncomment this when you are sure
//the script is working right!
//XLDelRow>xlBook,Sheet1,k
Endif
Let>k=k+1
Goto>start
Label>finish
XLQuit>xlBook
SRT>SearchExcel
Let>r=0
Let>foundit=0
Label>search
Add>r,1
If>r>maxrows
Goto>SearchExcel_exit
Endif
//Read Excel File
XLGetCell>xlBook,Sheet1,r,3,theValue
If>line=%theValue%
Let>foundit=1
MessageModal>Found a match! - %theValue%
Goto>SearchExcel_exit
Endif
Goto>search
Label>SearchExcel_exit
END>SearchExcel