Glad to hear so,
So I overestimated the need for flexibility in : "flexibility of choosing a defined range to copy from"
And indeed added not needed flexibility to what you wanted to have defined: "a defined cell to paste the values to"
Just one side note:
If you run code once, and there were 5 positive values in A1:A15 they will be copied to E5:E9
but then when you change your data in A1:A15 and only 2 values are positive, then they will be copied to E5 and E6, but content of E7:E9 will remain unchanged.
So I'd suggest adding clearing contents of possible output cells. for instance in such way:
Sub trial()
Dim inpRng As Range, outCell As Range, currCell As Range, lastrow as long
Set inpRng = Worksheets("Sheet1").Range("A1:A15")
With Worksheets("Sheet2")
Set outCell = .Cells(5, 5)
lastrow = .Cells(rows.count, 5).end(xlup).row
if lastrow<5 then lastrow=5
.range(.Cells(5, 5),.cells(lastrow,5)).clearcontents
end with
For Each currCell In inpRng
'...
Could be also easier just by adding to code from previous post (anywhere above the For loop).
Worksheets("Sheet2").RAnge("E5:E104").Clearcontents
Bookmarks