SmartCookie
New Member
- Joined
- Feb 22, 2021
- Messages
- 6
- Office Version
- 2019
- Platform
- Windows
Hello Friends,
I am trying to copy a range of data into a new sheet, but every single cell in this range need to repeat for four time. For example: (I have over 1000 cells in the original data)
The VBA code that I created loop through the original data selection, but couldn't copy to the right location, everytimes it overwritten the original data. See below:
Any help or insight will be greatly appreciated!!
Thanks
Silin
I am trying to copy a range of data into a new sheet, but every single cell in this range need to repeat for four time. For example: (I have over 1000 cells in the original data)
The VBA code that I created loop through the original data selection, but couldn't copy to the right location, everytimes it overwritten the original data. See below:
VBA Code:
Sub Copy1()
Dim wb As Workbook
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim X As Integer
Dim Y As Integer
Set wb = ThisWorkbook
Set ws1 = wb.Sheets("Silin")
Set ws2 = wb.Sheets("Sheet1")
LastRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
For X = 15 To 118
ws1.Cells(X, 2).Copy
ws2.Range(ws2.Cells(LastRow, 2), ws2.Cells(LastRow, 2).Offset(4, 0)).PasteSpecial
Application.CutCopyMode = False
Next X
End Sub
Any help or insight will be greatly appreciated!!
Thanks
Silin