Returning results to multiple location using VBA?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top