Need some help ?
Getting error Run-time error '1004': on execution of macro to copy contents on row 8 Columns B,C,D,E
When I click on debug it shows hanging up on this row
For Each rngCell In ThisWorkbook.Worksheets("Sheet1").Range("B11:D9" & Cells(Rows.Count, 4).End(x1Up).Row)
The "5" in cell (B:8) is the number of times I want it copied
B:8 5
C:8 Semi
D:8 CM-13
E:8 RS-Allied
Sub CopyRowsXTimes()
Dim rngCell As Range
This Workbook.Worksheets("Sheet1").Cells.ClearContents
For Each rngCell In ThisWorkbook.Worksheets ("Sheet1").Range("B11:D9" & Cells(Rows.Count, 4).End (x1Up).Row)
With ThisWorkbook.Worksheets("Sheet1")
.Cells(.UsedRange.SpecialCells(x1CellTypeLastCell).Row, 1).Resize(rngCell.Value, 4).Value = rngCell.Offset(, -3).Resize(1, 4).Value
(code is below)
Sub CopyRowsXTimes()
Dim rngCell As Range
'This Workbook.Worksheets("Sheet1").Cells.ClearContents
For Each rngCell In ThisWorkbook.Worksheets("Sheet1").Range("B11:D9" & Cells(Rows.Count, 4).End(x1Up).Row)
With ThisWorkbook.Worksheets("Sheet1")
.Cells(.UsedRange.SpecialCells(x1CellTypeLastCell).Row, 1).Resize(rngCell.Value, 4).Value = rngCell.Offset(, -3).Resize(1, 4).Value
End With
Next rngCell
Set rngCell = Nothing
End Sub
Thanks in advance for your help.
Dennis
Bookmarks