Skip to content

Instantly share code, notes, and snippets.

@erajanraja24
Created February 15, 2016 18:34
Show Gist options
  • Save erajanraja24/396fe00d19eaeb52cef7 to your computer and use it in GitHub Desktop.
Save erajanraja24/396fe00d19eaeb52cef7 to your computer and use it in GitHub Desktop.
Matrix form
Sub check()
Dim i As Integer, j As Integer, k As Integer, l As Integer, m As Integer, n As Integer, o As Integer
Dim count()
cnt = 0
lrow = ThisWorkbook.Sheets(1).Range("A65536").End(xlUp).Row
lcol = ThisWorkbook.Sheets(1).Cells(1, Columns.count).End(xlToLeft).Column
p = ThisWorkbook.Sheets(2).Range("A65536").End(xlUp).Row
q = ThisWorkbook.Sheets(2).Cells(1, Columns.count).End(xlToLeft).Column
Set sh1 = ThisWorkbook.Sheets(1)
'ReDim count(1 To i, 1 To n)
count = ThisWorkbook.Sheets(1).Range(Cells(2, 2), Cells(lrow, lcol)).Value
For i = 2 To lrow
For j = 2 To lrow
For k = 2 To lcol
If i <> j Then
If sh1.Cells(i, k) = sh1.Cells(j, k) Then
Debug.Print "cell value " & i; " " & k; "is equal to " & j; " " & k
ThisWorkbook.Sheets(4).Cells(i, k) = ThisWorkbook.Sheets(4).Cells(i, k) + ThisWorkbook.Sheets(3).Cells(i, k)
End If
End If
Next k
Next j
Next i
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment