09-06-2018, 08:39 PM
Hi everyone,
I have a script that compares two unsorted columns (in 2 differtent sheets) using .match.
If match gives me the row number then I check if columns are equal.
Is there a faster way?
Number of rows could be 20'000 to 200'000
Code:
CheckRow(objMyWorksheet1,objMyWorksheet2,i,x,z) is required because I need to see if there are some specific values that I have to ignore.
I'd like to speed up this part (and if exists, to use a faster way than match)
Code:
Thank you
I have a script that compares two unsorted columns (in 2 differtent sheets) using .match.
If match gives me the row number then I check if columns are equal.
Is there a faster way?
Number of rows could be 20'000 to 200'000
Code:
Code:
For i = 1 To rowCount1 Step 1
x = objXL.Application.Match(objMyWorksheet1.Cells(i,1).value, objXL.Sheets(sheet2)Range("A1:A"&rowCount2),0)
If not isNumeric(x) then
objMyWorksheet1.Cells(i,1).Interior.ColorIndex = 6
Else
For z = 2 To columnCount1 Step 1
rowA= trim(objMyWorksheet1.Cells(i,z).value)
rowB= trim(objMyWorksheet2.Cells(x,z).value)
If isnumeric(rowA) then rowA= Cdbl(rowA)
If isnumeric(rowB) then rowB= Cdbl(rowB)
If rowA <> rowBThen Call CheckRow(objMyWorksheet1,objMyWorksheet2,i,x,z)
Set rowA= nothing
Set rowB= nothing
next
End if
next
CheckRow(objMyWorksheet1,objMyWorksheet2,i,x,z) is required because I need to see if there are some specific values that I have to ignore.
I'd like to speed up this part (and if exists, to use a faster way than match)
Code:
Code:
For z = 2 To columnCount1 Step 1
rowA= trim(objMyWorksheet1.Cells(i,z).value)
rowB= trim(objMyWorksheet2.Cells(x,z).value)
If isnumeric(rowA) then rowA= Cdbl(rowA)
If isnumeric(rowB) then rowB= Cdbl(rowB)
If rowA <> rowBThen Call CheckRow(objMyWorksheet1,objMyWorksheet2,i,x,z)
Thank you