I'm surprised there aren't really any great ways to multiply a Range by a constant value. Sure you can use a loop, but that seems pretty long-winded for something that seems so simple. You can also use the Evaluate
statement, but the information page is so vague on what this actually does, so I would rather not. That leaves us with the PasteSpecial
method, which for some reason forces the active cell to change. This is annoying, because if you want to keep the activecell default on the page you're pasting it onto, you now have to add 4 lines of code to achieve it.
Before:
Sub sq()
Range("A1").Copy
Sheets(2).Range("F1:F20").PasteSpecial xlPasteValues, xlPasteSpecialOperationMultiply
Application.CutCopyMode = False
End Sub
After:
Sub sq()
Sheets(1).Range("A1").Copy
Sheets(2).Activate
adr = ActiveCell.Address
Sheets(2).Range("F1:F20").PasteSpecial xlPasteValues, xlPasteSpecialOperationMultiply
Application.CutCopyMode = False
Sheets(2).Range(adr).Select
Sheets(1).Activate
End Sub
Is this the generally accepted method of simply multiplying a range by a value or am I unaware of something else?