Hi All,
I've been trying to put together (read plagiarise!) a macro that will give me all the possible combinations of 3 columns of fields, which are "size", "colour", and "piping". Giving the results comma separated so i can split them with text to columns. This is what I have so far:
I get a "Invalid next control reference variable" error when I run it though....
Any Thoughts? Thanks!
I've been trying to put together (read plagiarise!) a macro that will give me all the possible combinations of 3 columns of fields, which are "size", "colour", and "piping". Giving the results comma separated so i can split them with text to columns. This is what I have so far:
Code:
Sub com()
Dim size As Range
Dim colour As Range
Dim piping As Range
Dim combination As Range
Dim counter
Set combination = Worksheets(1).Range("D:D")
counter = 1
With Worksheets(1)
For Each size In .Range("A1", .Range("A" & .Rows.Count).End(xlUp))
For Each colour In .Range("B1", .Range("B" & .Rows.Count).End(xlUp))
For Each piping In .Range("C1", .Range("C" & .Rows.Count).End(x1Up))
combination(counter) = size.Value & " , " & colour.Value & "," & piping.Value
counter = counter + 1
Next size
Next colour
Next piping
End With
End Sub
I get a "Invalid next control reference variable" error when I run it though....
Any Thoughts? Thanks!