daltonwkkt
New Member
Data Matching
Download excel file : http://adf.ly/1YXNL3
Download excel file : http://adf.ly/1YXNL3
Code:
Sub RoundedRectangle1_Click()
Sheet4.Cells.ClearContents
Sheet5.Cells.ClearContents
For m_column = 1 To 255
If Sheet2.Cells(1, m_column) = "" Then
Exit For
End If
Next m_column
For s_column = 1 To 255
If Sheet3.Cells(1, s_column) = "" Then
Exit For
End If
Next s_column
For m_row = 1 To 500000
If Sheet2.Cells(m_row, 1) = "" Then
Exit For
End If
For m_fill = 1 To m_column - 1
Sheet4.Cells(m_row, m_fill) = Sheet2.Cells(m_row, m_fill)
Next m_fill
For s_row = 1 To 500000
If Sheet3.Cells(s_row, 1) = "" Then
Exit For
End If
If Sheet2.Cells(m_row, 1) = Sheet3.Cells(s_row, 1) Then
For s_fill = 1 To s_column
Sheet4.Cells(m_row, s_fill + m_column) = Sheet3.Cells(s_row, s_fill)
Next s_fill
Sheet3.Cells(s_row, s_column + 1) = "MATCHED"
Else
'Sheet3.Cells(s_row, s_column + 1) = "UN-MATCHED"
End If
Next s_row
Sheet1.Cells(13, 4) = s_row - 1
Next m_row
Sheet1.Cells(12, 4) = m_row - 1
r_unmatched = 1
For fill_unmatched = 1 To 500000
If Sheet3.Cells(fill_unmatched, 1) = "" Then
Exit For
End If
If Sheet3.Cells(fill_unmatched, s_column + 1) = "" Then
For s_column_unmatched = 1 To s_column
Sheet5.Cells(r_unmatched, s_column_unmatched) = Sheet3.Cells(fill_unmatched, s_column_unmatched)
Next s_column_unmatched
r_unmatched = r_unmatched + 1
End If
Next fill_unmatched
Sheet1.Cells(15, 4) = r_unmatched - 1
Sheet1.Cells(14, 4) = s_row - r_unmatched
End Sub