Home > OS >  Using Evaluate to multiply values in a range
Using Evaluate to multiply values in a range

Time:04-15

I am using the following code to multiply the values in a range by 2:

input_rng = Evaluate(input_rng.Address & "*2")

What if the multiplier is stored in a variable instead? I tried replacing 2 with the variable name and it didn't seem to work. Any suggestions?

CodePudding user response:

I think Scott Craner's comment is spot on. Here's a full example in case it is helpful:

Sub test()
    Dim input_rng As Range
    Set input_rng = ActiveCell
    Dim factor As Single
    factor = 2
    input_rng = Evaluate(input_rng.Address & "*" & factor)
End Sub
  • Related