Hey All - newbie to the board and to macro programming, but not to programming in general. I'm currently trying to improve a macro that someone else wrote. It takes two lists of people (one old, one new), finds the matching entries by comparing ID numbers, then records any changes that have been made to that person's data. The macro currently takes about 10 minutes to run, and I think this could be remedied by improving the search function. Currently it's this:
Range("A1").Select 'Column A contains the ID numbers
Do While ActiveCell.Value <> id_number
search_i = search_i + 1
search_cell = "A" & search_i
Range(search_cell).Select
If ActiveCell.Value = "" Then
search_i = search_i_temp
Exit Do
End If
Loop
All I need to do is find out which row the id_number is in, or if the value doesn't exist in that column. Should be an exact match with the contents of the cell, not a substring.
What's the fastest way to find the information I need? Is there some way I can take advantage of the fact that the lists are sorted by ID number in order to speed things up?
Thanks in advance for any help you can give me.
Range("A1").Select 'Column A contains the ID numbers
Do While ActiveCell.Value <> id_number
search_i = search_i + 1
search_cell = "A" & search_i
Range(search_cell).Select
If ActiveCell.Value = "" Then
search_i = search_i_temp
Exit Do
End If
Loop
All I need to do is find out which row the id_number is in, or if the value doesn't exist in that column. Should be an exact match with the contents of the cell, not a substring.
What's the fastest way to find the information I need? Is there some way I can take advantage of the fact that the lists are sorted by ID number in order to speed things up?
Thanks in advance for any help you can give me.