4
41db14
I ran across a macro (see below) on this site by David McRitche which seems
to do what I want but, there are two things I would like the macro to do if
possible?
How can I edit this macro to do the following?
1. Have the macro run in the background. This macro ties up my cpu totally,
I can't doing anything until I stop it!!
2. Have the macro end when it see's the first blank cell in column "A" of
the master sheet. This macro just keeps running on, & on & on....
I have attempted to contact the author of this macro via email(no response)
that is why I have returned.. I'm not sure if its my three year old PC (P4)
or maybe the number of records I have but it seems to take a long time to
run. I am running Windows XP Pro and Office 2003.
I have a workbook that has two spreadsheets of data the master sheet (1) has
2,026 rows of data, the second sheet has 1,606 rows of data.
I want to compare the item number in column "A" in the master sheet against
the item number in column "A" in the second sheet.
The purpose is to identify the duplicate numbers between the two.
I am not a wiz at macros so any help would be greatly appreciated.
David McRitche's macro:
Sub FindDupes() 'assuming both sheets are in same book and book is open
Dim sht1 As Worksheet
Dim sht2 As Worksheet
Dim cell1 As Range
Dim cell2 As Range
Dim str As String
str = InputBox("Type name of first sheet")
Set sht1 = Worksheets(str)
str = InputBox("Type name of second sheet")
Set sht2 = Worksheets(str)
For Each cell1 In sht1.Columns(1).Cells
For Each cell2 In sht2.Columns(1).Cells
If cell2.Value = cell1.Value Then
cell1.Interior.ColorIndex = 3
cell2.Interior.ColorIndex = 3
End If
Next cell2
Next cell1
End Sub
to do what I want but, there are two things I would like the macro to do if
possible?
How can I edit this macro to do the following?
1. Have the macro run in the background. This macro ties up my cpu totally,
I can't doing anything until I stop it!!
2. Have the macro end when it see's the first blank cell in column "A" of
the master sheet. This macro just keeps running on, & on & on....
I have attempted to contact the author of this macro via email(no response)
that is why I have returned.. I'm not sure if its my three year old PC (P4)
or maybe the number of records I have but it seems to take a long time to
run. I am running Windows XP Pro and Office 2003.
I have a workbook that has two spreadsheets of data the master sheet (1) has
2,026 rows of data, the second sheet has 1,606 rows of data.
I want to compare the item number in column "A" in the master sheet against
the item number in column "A" in the second sheet.
The purpose is to identify the duplicate numbers between the two.
I am not a wiz at macros so any help would be greatly appreciated.
David McRitche's macro:
Sub FindDupes() 'assuming both sheets are in same book and book is open
Dim sht1 As Worksheet
Dim sht2 As Worksheet
Dim cell1 As Range
Dim cell2 As Range
Dim str As String
str = InputBox("Type name of first sheet")
Set sht1 = Worksheets(str)
str = InputBox("Type name of second sheet")
Set sht2 = Worksheets(str)
For Each cell1 In sht1.Columns(1).Cells
For Each cell2 In sht2.Columns(1).Cells
If cell2.Value = cell1.Value Then
cell1.Interior.ColorIndex = 3
cell2.Interior.ColorIndex = 3
End If
Next cell2
Next cell1
End Sub