Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50085

[SOLVED] Code explanation please

$
0
0
Hi could someone explain to me exactly what the code below is doing especially the IF Statements

Thanks in advance

Code:

Sub Calc()

    Sheets("Sheet2").Activate
    ActiveSheet.Unprotect Password:="0000"
    Range("TensionR").Locked = False
    Range("CompressionR").Locked = False
   
    If Left(Right(Range("b1").Value, 1), 1) = "." Then
        Range("o1").FormulaR1C1 = "=1"
        Run ("Dec0")
  Else
   
    If Left(Right(Range("b1").Value, 1), 1) = "." Then
        Range("o1").FormulaR1C1 = "=1"
        Run ("Dec0")
  Else
   
    If Left(Right(Range("b1").Value, 2), 1) = "." Then
        Range("o1").FormulaR1C1 = "=2"
        Run ("Dec1")
  Else
   
    If Left(Right(Range("b1").Value, 3), 1) = "." Then
        Range("o1").FormulaR1C1 = "=3"
        Run ("Dec2")
 Else
   
    If Left(Right(Range("b1").Value, 4), 1) = "." Then
        Range("o1") = 4
        Run ("Dec3")
  Else
   
    If Left(Right(Range("b1").Value, 5), 1) = "." Then
        Range("o1").FormulaR1C1 = "=5"
        Run ("Dec4")
  Else
   
    Range("o1").FormulaR1C1 = "=0"
   
    End If
    End If
    End If
    End If
    End If
    End If
   
    ActiveSheet.Protect Password:="0000"
   
End Sub


Viewing all articles
Browse latest Browse all 50085

Trending Articles