I am running Excel 2007. I am a beginning to intermediate VBA programmer....
I have a large spreadsheet with over 2 years of data in it. It has over 155,000 rows. Because of different users, some of the data entry has different entries in column O than what it should be. The data in column O correponds to a part number in column P. My job is to clean the data up.
I wrote a quick do loop statement to search for a part number in column P, check the corresponding entry in column O and change it if needed.
The code works, but it takes almost 25 minutes to work through the spreadsheet in columns P:O one time (all 155,000 rows).
Can anyone help me speed this up?
Here is my do loop code:
I have a large spreadsheet with over 2 years of data in it. It has over 155,000 rows. Because of different users, some of the data entry has different entries in column O than what it should be. The data in column O correponds to a part number in column P. My job is to clean the data up.
I wrote a quick do loop statement to search for a part number in column P, check the corresponding entry in column O and change it if needed.
The code works, but it takes almost 25 minutes to work through the spreadsheet in columns P:O one time (all 155,000 rows).
Can anyone help me speed this up?
Here is my do loop code:
Code:
Sub Correct_Data()
Sheets("Data").Select
Range("P2").Select
Do
If Selection = "AREC06099" Then
ActiveCell.Offset(rowOffset:=0, columnOffset:=-1).Activate
ActiveCell.Formula = "CAP .001UF CM 50V 5% C0G 0402"
ActiveCell.Offset(rowOffset:=1, columnOffset:=1).Activate
End If
ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
Loop Until ActiveCell = ""
End Sub