T
trigo1
Thanks for the help in advance!! The macro below compares data from a
range and lists all the possible permutations (combinations) of the
data.
EXAMPLE...the range of:
Price
MGP
Comfort
Style
will return this data:
Price <compared to> MGP
Price <compared to> Comfort
Price <compared to> Style
MGP <compared to> Comfort
MGP <compared to> Style
Comfort <compared to> Style
How can I alter the macro to ALSO return the data to another sheet and
aranged in a table?
EXAMPLE:
Price MGP Comfort Style
Price
MGP
Comfort
Style
Here is macro:
abc()
Dim rw As Long, i As Long, j As Long
Dim lb As Long, ub As Long
Dim rng As Range, icol As Long
Set rng = Range("c7:c10")
lb = rng(1).Row
ub = rng(rng.Count).Row
icol = rng.Column
rw = 6
For i = lb To ub
For j = i + 1 To ub
If StrComp(Cells(i, icol), Cells(j, icol), _
vbTextCompare) <> 0 Then
rw = rw + 1
Cells(rw, icol + 1) = Cells(i, icol) & " <compared to>
" & Cells(j, icol)
End If
Next
Next
End Sub
range and lists all the possible permutations (combinations) of the
data.
EXAMPLE...the range of:
Price
MGP
Comfort
Style
will return this data:
Price <compared to> MGP
Price <compared to> Comfort
Price <compared to> Style
MGP <compared to> Comfort
MGP <compared to> Style
Comfort <compared to> Style
How can I alter the macro to ALSO return the data to another sheet and
aranged in a table?
EXAMPLE:
Price MGP Comfort Style
Price
MGP
Comfort
Style
Here is macro:
abc()
Dim rw As Long, i As Long, j As Long
Dim lb As Long, ub As Long
Dim rng As Range, icol As Long
Set rng = Range("c7:c10")
lb = rng(1).Row
ub = rng(rng.Count).Row
icol = rng.Column
rw = 6
For i = lb To ub
For j = i + 1 To ub
If StrComp(Cells(i, icol), Cells(j, icol), _
vbTextCompare) <> 0 Then
rw = rw + 1
Cells(rw, icol + 1) = Cells(i, icol) & " <compared to>
" & Cells(j, icol)
End If
Next
Next
End Sub