Hi People, Good Evening.
This question was solved by the gentle Isabelle.
Thanks again.
The answer:
-------------------------------------------------------------
Sub test()
Dim i As Integer, n1 As Integer, n2 As Integer
n1 = 1
For i = 1 To 3000 Step 3
n2 = n2 + 1
With Sheets("Sheet2")
Sheets("Sheet1").Range("A" & n1).Copy .Range(.Cells(i, 1), .Cells(i + 2, 1))
Sheets("Sheet1").Range("B" & n2).Copy .Range(.Cells(i, 2), .Cells(i + 2, 2))
Sheets("Sheet1").Range("C1:C3").Copy .Range(.Cells(i, 3), .Cells(i + 2, 3))
Application.CutCopyMode = False
End With
If n2 = 20 Then n1 = n1 + 1: n2 = 0
Next
End Sub
-------------------------------------------------------------
Topic can be CLOSED.
Quote:
Originally Posted by Mazzaropi
Hi People, Good Morning.
I need to use three columns of data to generate a new group in another tab.
The new one will be a combinations of all the three columns.
A little example:
Sheet 1:
A_______B_______C
CAR_____BLUE____BIG
BUS_____RED_____SMALL
________YELLOW
Waited results at Sheet 2:
A_______B_______C
CAR_____BLUE____BIG
CAR_____BLUE____SMALL
CAR_____RED_____BIG
CAR_____RED_____SMALL
CAR_____YELLOW__BIG
CAR_____YELLOW__SMALL
BUS_____BLUE____BIG
BUS_____BLUE____SMALL
BUS_____RED_____BIG
BUS_____RED_____SMALL
BUS_____YELLOW__BIG
BUS_____YELLOW__SMALL
I found here a code that works perfectly.
But was made to use TWO columns.
It was made by a forum user: Isabelle.
----------------------------------------------------
Sub test()
Dim i As Integer, x As String, y As String, n As Integer
For i = 1 To 17500 Step 350
..n = n + 1
..With Sheets("Sheet2")
....Sheets("Sheet1").Range("A" & n).Copy .Range(.Cells(i, 1), .Cells(i + 349, 1))
....Sheets("Sheet1").Range("B1:B350").Copy .Range(.Cells(i, 2), .Cells(i + 349, 2))
....Application.CutCopyMode = False
..End With
Next
End Sub
----------------------------------------------------
I tried to adapt this code to a THREE column of data.
But I´m getting errors.
Please, could someone help me with this?
I have three columns of data:
A1:A50 - Music partitures
B1:B20 - Musical instruments
C1:C3..- Participation
50 itens * 20 itens * 3 itens = 3,000 itens
If anyone can help I will apreciate a lot.
I´m just a beginner in VBA.
Thanks in advance.
Have a nice day.
|