Sorry, but I begin to use VBA and I want/need to learn more. I will be apreaciated for any clues.
I am going to assume that since you mentioned VBA that you are looking for Excel macro help.
If this is the case, this thread should be probably moved to the VB6 forum as that is the most appropriate one that I can think of.
TnTinMN,
Yes, it sounds like what I need.
Here is a basic macro with minimal error checking. It asks you to select two ranges and it compares the first column in each range to produce a result array. It then asks you for a place to copy the results to in a worksheet.
Private Sub CompareColumns()
Dim Col1 As Range
Dim Col2 As Range
On Error Resume Next
Set Col1 = Application.InputBox("Select 1st column", , ActiveCell.Address, _
, , , , vbString)
If Col1 Is Nothing Then Exit Sub
Set Col2 = Application.InputBox("Select 2nd column", , ActiveCell.Address, _
, , , , vbString)
If Col2 Is Nothing Then Exit Sub
On Error GoTo 0 ' cancel resume next
'Determine the longer list
Dim shortCol As Range
Dim LongCol As Range
If Col1.Rows.Count < Col2.Rows.Count Then
Set shortCol = Col1
Set LongCol = Col2
Else
Set shortCol = Col2
Set LongCol = Col1
End If
Dim LongColMatched() As Boolean ' Used to indicate matched value used if duplicates exist
ReDim LongColMatched(0 To LongCol.Rows.Count - 1)
' declare a result array …