Saturday, April 20, 2019

Multiply all the Values by a Number


Multiply all the Values by a Number
Let’s you have a list of numbers and you want to multiply all the number with a particular. Just use this code.
Select that range of cells and run this code. It will first ask you for the number with whom you want to multiple and then instantly multiply all the numbers with it.
Sub multiplyWithNumber()
Dim rng As Range
Dim c As Integer c = InputBox("Enter number to multiple", "Input Required")
For Each rng In Selection
If WorksheetFunction.IsNumber(rng) Then
rng.Value = rng * c
Else
End If
Next rng
End Sub

No comments:

Post a Comment