Compairing 2 sheets selected from a userform

jimayers

Board Regular
Joined
Nov 14, 2010
Messages
99
Hello - I have a code to populate a userform of all the sheets:
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
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,217,359
Messages
6,136,097
Members
449,991
Latest member
IslandofBDA

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top