Macro works great in 2007 created from a expert in this forum. One associate I work with uses a older excel format 98 I believe and willl not upgrade??.
The code below errors when promting the user here
With Application.FileDialog(msoFileDialogOpen)
I also would bet it would error elsewhere too. Is there anyone that could help out converting this code to the earlier version.
Option Explicit
Private Sub Workbook_Open()
Dim wb1 As Workbook, wb2 As Workbook
Dim cell As Range, counter As Long
' Prompt user to select a file1
With Application.FileDialog(msoFileDialogOpen)
.InitialFileName = ThisWorkbook.Path ' Default path
.FilterIndex = 3
.Title = "Please Select a File"
.ButtonName = "Open"
.AllowMultiSelect = False
.Show
If .SelectedItems.Count = 0 Then Exit Sub ' User clicked cancel
Set wb1 = Workbooks.Open(Filename:=.SelectedItems(1))
End With
' Prompt user to select a file2
With Application.FileDialog(msoFileDialogOpen)
.InitialFileName = ThisWorkbook.Path ' Default path
.FilterIndex = 3
.Title = "Please Select a File"
.ButtonName = "Open"
.AllowMultiSelect = False
.Show
If .SelectedItems.Count = 0 Then Exit Sub ' User clicked cancel
Set wb2 = Workbooks.Open(Filename:=.SelectedItems(1))
End With
For Each cell In wb1.Sheets(1).Range("E11:H25")
If Not IsEmpty(cell) Then
If cell.Value = wb2.Sheets(1).Range(cell.Address).Value Then
cell.Interior.Color = vbYellow
wb2.Sheets(1).Range(cell.Address).Interior.Color = vbYellow
counter = counter + 1
End If
End If
Next cell
MsgBox counter & " Duplicates Highlighted", vbInformation, "Comparison Complete"
Me.Close True
Debug.Print
End Sub
Thanks, Tom
Bookmarks