Team,
I routinely find myself using For Each loops with embedded If statements to quickly parse down Excel data, and place various values on other sheets. Although not optimal, for smaller Excel sheets this has always quickly worked for me. I am being handed a project based on my Excel knowledge where I have to parse through 10+ 1,000,000 Row Worksheets. For a project this size, I do believe my routine method will be too clunky/slow. Does anyone have any recommendations for a better high volume method? One shortcoming of this method I have found previously is the number of times it loops through Cel & Cel2, however I have never figured out how to break the extra loop. Below is an example of what I would typically use.
I routinely find myself using For Each loops with embedded If statements to quickly parse down Excel data, and place various values on other sheets. Although not optimal, for smaller Excel sheets this has always quickly worked for me. I am being handed a project based on my Excel knowledge where I have to parse through 10+ 1,000,000 Row Worksheets. For a project this size, I do believe my routine method will be too clunky/slow. Does anyone have any recommendations for a better high volume method? One shortcoming of this method I have found previously is the number of times it loops through Cel & Cel2, however I have never figured out how to break the extra loop. Below is an example of what I would typically use.
VBA Code:
Sub Peteor()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.EnableEvents = False
Dim Cel As Range
Dim Rng As Range
Dim Cel2 As Range
Dim Rng2 As Range
Set Rng = Worksheets("Sheet1").Range("B2:B10000)
Set Rng2 = Worksheets("Sheet2").Range("C2:C10000)
For Each Cel In Rng
For Each Cel2 In Rng2
If Cel.Value = Cel2.Value Then
Worksheets("Sheet3").Range("F" & Rows.Count).End(xlUp).Offset(1, 0) = Cel.Offset(0, 4).Value
Else
End If
Next Cel2
Next Cel
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
Last edited by a moderator: