Reputation: 11
I am working on a code where I will give input from the drop down that from which date we need to paste the data in row and next row suggest how many cells to the right of that i will go pasting the same data.
Lest assume I have a date drop down in cell "E8"
and "E9"
have what needs to copy and "E10"
have how many times I have to paste the value from "E9"
to the right. I have a date as a header from column (J10:J40)
please help
Worksheets("project Allocation").Range("E8").Copy
'PasteSpecial Values Only
Worksheets("Project Allocation").Range("******").PasteSpecial Paste:=xlPasteValues
Expected is for the selected dates pasting the values from cell "E9"
Upvotes: 1
Views: 44
Reputation: 37367
Try this:
Sub CopyCell()
Dim howManyTimes As Long, i As Long
howManyTimes = Range("E10").Value
For i = 1 To howManyTimes
Range("E9").Offset(0, i).Value = Range("E9").Value
Next
End Sub
Upvotes: 1