I have a macro which concatenate some cells together for me then pastes it into sheet 2 and 3. However I need it to repeat each cell twice
Sheet2 only needs from cell A2 to A14 and pasted into Sheet2 starting at J14
and Sheet3 needs everything from cell A15 till last row and pasted into Sheet3 starting at J8
my code doesn't seem to be working for my sheet3, but sheet1 is working decently
example: in my sheet 1 will be
A | B | C
--------------------
Name1 | date | info
Name2 | date | info
after I concatenate everything I need it to look like
A |
--------------------
Name1 - date - info |
Name1 - date - info |
Name2 - date - info |
Name2 - date - info |
My current code:
Sub Concat()
Sheets("Sheet1").Select
Dim lRow As Long, i As Long
Dim rng As Range
Dim lr2 As Long
Set rng = Range("A16:A" & Cells(Rows.Count, "A").End(xlUp).Row)
Set rng2 = Range("A15:A" & Cells(Rows.Count, "A").End(xlUp).Row)
Debug.Print rng.Address(External:=True)
lr2 = 1
lRow = rng.Row
For i = 2 To lRow
ActiveWorkbook.Sheets("Sheet2").Cells(i + 12, 10) = Cells(i, 1) & " - " & Cells(i, 2) & " - " & Cells(i, 3) & " - " & Cells(i, 4)
Next i
lRow2 = rng2.Row
For i = 2 To lRow2
ActiveWorkbook.Sheets("Sheet3").Cells(i + 6, 10) = Cells(i + 15, 1) & " - " & Cells(i + 15, 2) & " - " & Cells(i + 15, 3) & " - " & Cells(i + 15, 4)
Next i
End Sub
I found a code which does repeat the column but I cant get to implement it into my code
Sub copPas()
Dim s1 As Worksheet, s2 As Worksheet
Set s1 = Worksheets("Sheet1")
Set s2 = Worksheets("Sheet2")
Dim lr As Long, lr2 As Long
Dim i As Long
lr = s1.Range("A" & Rows.Count).End(xlUp).Row
lr2 = 1
Application.ScreenUpdating = False
For i = 1 To lr
s2.Range("A" & lr2).Resize(2).Value = s1.Range("A" & i).Value
lr2 = lr2 + 2
Next i
Application.ScreenUpdating = True
End Sub