Macro to perform arithmetic operation to a selection


Add a number to every cell in the selection


Sub AddNumber()
Dim X As Range
Dim Y As Integer
Y = InputBox("Enter the Number to Add")
For Each X In Selection
If WorksheetFunction.IsNumber(X) Then
X.Value = X + Y
Else
End If
Next X
End Sub

Multiply a number to every cell in the selection


Sub MultiplyNumber()
Dim X As Range
Dim Y As Integer
Y = InputBox("Enter the Number to Multiply")
For Each X In Selection
If WorksheetFunction.IsNumber(X) Then
X.Value = X * Y
Else
End If
Next X
End Sub

How to use codes shared here?