Hello - I have a code to populate a userform of all the sheets:
I want to use 2 of the chosen sheets from the userform2 and compare data in column 2. When there is duplicate records I would like to highlight a certain cell. I am having trouble, and am wondering if I need to put the column B data in an array to compare first.
Thanks for any help - Jim A
Code:
Private Sub UserForm_Activate()
Application.ScreenUpdating = False
Dim r, NumShts As Long
Dim i As Integer
NumShts = ThisWorkbook.Worksheets.count
With UserForm2
i = 0
.ListBox2.Clear 'clear all existing list box items
'populating listbox2 with sheet names
For r = 1 To NumShts
.ListBox2.AddItem
.ListBox2.List(i, 0) = ThisWorkbook.Worksheets(r).NAME
i = i + 1
Next r
End With
Application.ScreenUpdating = True
End Sub
I want to use 2 of the chosen sheets from the userform2 and compare data in column 2. When there is duplicate records I would like to highlight a certain cell. I am having trouble, and am wondering if I need to put the column B data in an array to compare first.
Thanks for any help - Jim A