msal4434
9 years agoOccasional Contributor
Comparing 2 xls files with the specific column.
Hi There,
I need a little help to compare attached sheets A and B.
I am able to read A and B files separately and can display the output.
Read value A1, D1 from A.xls if A1 value available in b.xls then compare A.A1, A.D1 with B.A1, B.E1.
would like to compare all the values in the same way.
SCRIPT
Reading from A.xls Sub Readfromexcel() Set Excel = Sys.OleObject("Excel.Application") Excel.Workbooks.Open("A.xls") RowCount = Excel.ActiveSheet.UsedRange.Rows.Count ' log.message RowCount ColumnCount = Excel.ActiveSheet.UsedRange.Columns.Count 'log.message ColumnCount 'For i = 1 To RowCount for SI = 1 to ColumnCount For SJ = 1 To RowCount Ss = Excel.Cells(SJ,SI) 'log.message S SCV = "3" IF Ss = SCV then For SInn = 2 To rowcount SCC = Excel.Cells(SInn,SJ) SHV = Excel.Cells(SInn,SI) If SHV > 0 then log.message "State:" & Ss log.message "Charge Code is avaliable in Source file:" & SCC log.message "Value is Zero is avaliable in Source file:" & SHV '' Export from VIP Net Else log.message "State:" & Ss log.message "Charge Code is avaliable in Source file Price is zero:" & SCC log.message "Value is Zero is avaliable in Source file:" & SHV end if Next end if Exit For Next Next Excel.Quit End Sub
|