Reputation: 265
I have a variable that is used as a range and am looking for a better way to copy/paste from it. I know about the ".copy destination:=" method but I am copy/pasting the offset cells and not the variable range and I am have trouble figuring out how to do it without this ugly code:
current.Range(origin).Select
current.Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(0, 3)).Copy
current.Range(dest).Select
current.Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(0, 3)).PasteSpecial xlPasteAll
Upvotes: 0
Views: 1010
Reputation: 35853
Try this:
With current.Range(origin)
current.Range(.Offset(0, 1), .Offset(0, 3)).Copy _
Destination:=current.Range(dest).Offset(0, 1)
End With
or this one even better:
With current
.Range(origin).Offset(0, 1).Resize(, 3).Copy _
Destination:=.Range(dest).Offset(0, 1)
End With
Upvotes: 1