Hi
Would somebody know why the code causes #NAME? to be returned in the cell instead of a value? I know it is caused when Excel doesn't recognize text in a formula, however I think everything is defined correctly and VB does not return any errors. I tried defining the variables as Integers and As Variant,
Thank you
Would somebody know why the code causes #NAME? to be returned in the cell instead of a value? I know it is caused when Excel doesn't recognize text in a formula, however I think everything is defined correctly and VB does not return any errors. I tried defining the variables as Integers and As Variant,
Code:
Dim tireradius
Dim Wheelaxleefficiency
tireradius = 0.1915
Wheelaxleefficiency = 0.99
Range("p1").Value = "Twheel/axle reqd"
Range("p2").Select
Do
If ActiveCell.Offset(0, -12) = ActiveCell.Offset(-1, -12) Or ActiveCell.Offset(0, -9) > 0 Then
ActiveCell.FormulaR1C1 = "=(rc[-1] * tireradius) / Wheelaxleefficiency"
Else
ActiveCell.FormulaR1C1 = "=(rc[-1] * tireradius) * Wheelaxleefficiency"
End If
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell(1, -1))