Hi maximusa and welcome to the forum,
Here is the code that will work on your 3 column problem. This should give you a head start on doing one with an unknown number of columns.
Sub maximusa()
Dim LastCRow As Double
Dim LastBRow As Double
Dim LastARow As Double
Dim RowACtr As Double
Dim RowBCtr As Double
Dim RowCCtr As Double
Dim LastERow As Double
LastARow = Cells(Rows.Count, "A").End(xlUp).Row
LastBRow = Cells(Rows.Count, "B").End(xlUp).Row
LastCRow = Cells(Rows.Count, "C").End(xlUp).Row
Columns("E:E").ClearContents
Cells(1, "E") = "Results"
For RowACtr = 1 To LastARow
For RowBCtr = 1 To LastBRow
For RowCCtr = 1 To LastCRow
LastERow = Cells(Rows.Count, "E").End(xlUp).Row
Cells(LastERow + 1, "E") = Cells(RowACtr, "A") & "-" & _
Cells(RowBCtr, "B") & "-" & Cells(RowCCtr, "C")
Next RowCCtr
Next RowBCtr
Next RowACtr
End Sub
VBA recursive loop for Maximusa.xlsm
Bookmarks