Hi,
I have a worksheet with data on column A and Column F.
Data on column A is the the month of the year 1-12 repeated 50 times.
I have another worksheet with a list of 50 people and I need to copy each persons information 12 times in column B - E on the other worksheet.
Built a macro to do this but it doesn't seem to be working. It seems that the way I'm trying to pass the Range on the Copy statement is giving me an error. But even when I take that out the code is not actually behaving as I'd expect. I think my logic is correct and the issue has to do with the syntax. Any ideas?
I have a worksheet with data on column A and Column F.
Data on column A is the the month of the year 1-12 repeated 50 times.
I have another worksheet with a list of 50 people and I need to copy each persons information 12 times in column B - E on the other worksheet.
Built a macro to do this but it doesn't seem to be working. It seems that the way I'm trying to pass the Range on the Copy statement is giving me an error. But even when I take that out the code is not actually behaving as I'd expect. I think my logic is correct and the issue has to do with the syntax. Any ideas?
VBA Code:
Sub addDpRep()
Dim x As Integer
Dim y As Integer
'COUNT ROWS WITH DATA DP SHEET
x = Worksheets("DPs").Range("A:A").Cells.SpecialCells(xlCellTypeConstants).Count
'COUNT ROWS WITH DATA UPLOAD SHEET
y = Worksheets("FOR FILE").Range("B:B").Cells.SpecialCells(xlCellTypeConstants).Count
For i = 1 To x
Worksheets("DPs").Range(Cells(i + 1, 1), Cells(i + 1, 4)).Copy
For j = 1 To 12
Worksheets("FOR FILE").Cells(y + j, 2).PasteSpecial Paste:=xlPasteValues
Next j
Next i
End Sub