The below code evaluate certain conditions so my Range("TPC[CCProduction-S]") can get a value. The code does the work, however, my Range("TPC[CCProduction-S]") sticks to the very first result.
Is this code actually a good approach? can I improve it? suggestions...
There is a copy of my project attached to this thread. Thanks.
[CODE]
Is this code actually a good approach? can I improve it? suggestions...
There is a copy of my project attached to this thread. Thanks.
[CODE]
PHP Code:
Sub CCProductionPS()
Dim SawPoweredBy As Range
Set SawPoweredBy = Range("TPC[Saw Power" & Chr(10) & "Source]")
Dim SConfiguration As Range
Set SConfiguration = Range("TPC[Section" & Chr(10) & "Configuration]")
Dim CCProduction As Range
Set CCProductionS = Range("TPC[CCProduction-S]")
If SawPoweredBy.Value = "Electricity" And SConfiguration.Value = "Short Run" Then
CCProductionS.FormulaR1C1 = "=INDEX(PR[E-Short Run],MATCH([CODE],PR[CODE],0))"
Else
If SawPoweredBy.Value = "Electricity" And SConfiguration.Value = "Long Run" Then
CCProductionS.FormulaR1C1 = "=INDEX(PR[E-Long Run],MATCH([CODE],PR[CODE],0))"
Else
If SawPoweredBy.Value = "Gasoline" And SConfiguration.Value = "Short Run" Then
CCProductionS.FormulaR1C1 = "=INDEX(PR[G-Short Run],MATCH([CODE],PR[CODE],0))"
Else
If SawPoweredBy.Value = "Gasoline" And SConfiguration.Value = "Long Run" Then
CCProductionS.FormulaR1C1 = "=INDEX(PR[G-Long Run],MATCH([CODE],PR[CODE],0))"
Else
If SawPoweredBy.Value = "Diesel" And SConfiguration.Value = "Short Run" Then
CCProductionS.FormulaR1C1 = "=INDEX(PR[D-Short Run],MATCH([CODE],PR[CODE],0))"
Else
If SawPoweredBy.Value = "Diesel" And SConfiguration.Value = "Long Run" Then
CCProductionS.FormulaR1C1 = "=INDEX(PR[D-Long Run],MATCH([CODE],PR[CODE],0))"
End If
End If
End If
End If
End If
End If
End Sub