Have seen a lot of forums giving solutions where the code loops through each cell and does the operator. In a lot of cases, error handling is also required to manage cells with erroneous values.
The following code eliminates the need to loop through each cell (in some cases, 1000s of cells), and one doesn't need to worry about erroneous cells either. It is also pretty fast, compared to looping through all those cells.
Code
Public Sub AddSubDivMulRangeCaller()
AddSubDivMulRange Selection, 1000, "*"
End Sub
Private Sub AddSubDivMulRange(ByRef rngCellToADSM As Range, ByVal varASDMWith As Variant, ByVal strOperator As String)
'strOperator can be any of "+","-","/","*"
rngCellToADSM.Value = Application.Evaluate("=(" & rngCellToADSM.Address & ")" & strOperator & varASDMWith)
End Sub
Display More
Any corrections/suggestions are welcome.