mrFlibble47
New Member
- Joined
- Aug 24, 2007
- Messages
- 40
Hi,
I have the following code that matches the entries in column A against those in column C and prints "match" in the adjacent cell in column B when the entry in A is present somewhere in column C.
what i'm wondering is, is there a way of making this run much faster (other than stopping screen updating) as when there are several thousand entries in each column it can take a fair while to run. I'm thinking maybe there's an inbuilt function in excel that I am not aware of that could be used.
One possibility I just thought of is getting the 2nd loop to stop when a match is found rather than run through the entire list in column C as it currently does.
I have the following code that matches the entries in column A against those in column C and prints "match" in the adjacent cell in column B when the entry in A is present somewhere in column C.
Code:
Sub macro1()
Dim i As Integer
Dim j As Integer
i = 0
Do
i = i + 1
Range("B1") = i
j = 1
Do
j = j + 1
If Cells(i, 1) = Cells(j, 3) Then Cells(i, 2) = "Match"
Loop Until Cells(j, 3) = ""
Loop Until Cells((i + 1), 1) = ""
End Sub
what i'm wondering is, is there a way of making this run much faster (other than stopping screen updating) as when there are several thousand entries in each column it can take a fair while to run. I'm thinking maybe there's an inbuilt function in excel that I am not aware of that could be used.
One possibility I just thought of is getting the 2nd loop to stop when a match is found rather than run through the entire list in column C as it currently does.