Reputation: 3041
I am trying to copy the formats from a cell into two other cells.
.ActiveSheet.Range("C" & SelRowNumber).Select
.Selection.Copy
.ActiveSheet.Range("A" & SelRowNumber & ":B" & SelRowNumber).Select
.Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
I don't want to use Select or Selection because it is not being considered as a best practice.
I know how to assign activesheet to an worksheet object, but I need some clarity on simplifying the other parts of the code.
Upvotes: 1
Views: 37
Reputation: 29171
No need to select, just do:
With ActiveSheet
.Range("C" & SelRowNumber).Copy
.Range("A" & SelRowNumber & ":B" & SelRowNumber).PasteSpecial ...
end with
Upvotes: 3