Hello guys, im currently working with 2 huuuuug excel files the one in ws3 contains more than 13000 lignes and ws2 contains more than 2000 lignes.
my code is trying to compare the column E with the column J and if it finds two members that are equals,then it verifies if the one in ws3 same ligne column "D" is an output ,if yes then it verifies for the same ligne if the column B of ws3 and M(13) of ws2 are equal if not add them into a datagridview.
can you help me how to make this loop work faster because now it takes 5 minutes to run tank you so much in advanced
Code:Dim findme3 As Microsoft.Office.Interop.Excel.Range = ws3.Range("E2:E" & range3.Rows.Count) Dim findme4 As Microsoft.Office.Interop.Excel.Range = ws2.Range("J5:J" & Range2.Rows.Count) Dim MyArra1 As Object(,) = CType(findme3.Value, Object(,)) Dim MyArra2 As Object(,) = CType(findme4.Value, Object(,)) For f = 1 To MyArra2.Length For s = 1 To MyArra1.Length If UCase(MyArra1(s, 1)) = UCase(MyArra2(f, 1)) Then ran1 = ws2.Cells(f + 4, 13) ran2 = ws3.Cells(s + 1, 2) ran3 = ws3.Cells(s + 1, 4) If ran3.Text = "Output" Then If ran2.Text <> ran1.Text Then Form2.DataGridView3.Rows.Add(MyArra1(s, 1), ran1.Text, ran2.Text) End If End If End If Next Next




Reply With Quote
