Range("H1").Select
ActiveCell.FormulaR1C1 = "Range Total"
Range("I1").Select
ActiveCell.FormulaR1C1 = "Range Real"
Range("I2").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-5]>=RC[-2],(RC[-5]-RC[-2])*10,(RC[-2]-RC[-5])*10)"
Range("H2").Select
ActiveCell.FormulaR1C1 = "=(RC[-3]-RC[-2])*10"
Range("H3").Select
Do Until ActiveCell.Offset(0, -1).Value = ""
ActiveCell.FormulaR1C1 = "=(RC[-3]-RC[-2])*10"
ActiveCell.Offset(0, 1).Activate
ActiveCell.FormulaR1C1 = "=IF(RC[-5]>=RC[-2],(RC[-5]-RC[-2])*10,(RC[-2]-RC[-5])*10)"
ActiveCell.Offset(1, -1).Activate
Loop
This code fills columns "H" and "I" with values calculated with a if formula from values of the columns before and multiplied with a fixed value of "10".
What I wanted was to ask for a number with an application.inputbox and used it as a multiplier in the if formula.
Dim factor As Integer
factor = Application.InputBox("What is the multiplier value :", Type:=1)
Range("H1").Select
ActiveCell.FormulaR1C1 = "Range Total"
Range("I1").Select
ActiveCell.FormulaR1C1 = "Range Real"
Range("I2").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-5]>=RC[-2],(RC[-5]-RC[-2])*10,(RC[-2]-RC[-5])*factor)"
Range("H2").Select
ActiveCell.FormulaR1C1 = "=(RC[-3]-RC[-2])*factor"
Range("H3").Select
Do Until ActiveCell.Offset(0, -1).Value = ""
ActiveCell.FormulaR1C1 = "=(RC[-3]-RC[-2])*factor"
ActiveCell.Offset(0, 1).Activate
ActiveCell.FormulaR1C1 = "=IF(RC[-5]>=RC[-2],(RC[-5]-RC[-2])*10,(RC[-2]-RC[-5])*factor)"
ActiveCell.Offset(1, -1).Activate
Loop
This was my atempt and it doesn't work