Function safeStock(fab As String, partname As String)
Application.Volatile
Select Case fab
Case "A"
safeStock = Application.Evaluate("=ROUNDUP(SUMIF(Main!$CF:$CF,""" & partname & """,Main!CH:CH),0)")
Case "B"
safeStock = Application.Evaluate("=ROUNDUP(SUMIF(Main!$CP:$CP,""" & partname & """,Main!CR:CR),0)")
Case "C"
safeStock = Application.Evaluate("=ROUNDUP(SUMIF(Main!$CZ:$CZ,""" & partname & """,Main!DB:DB),0)")
Case Else
safeStock = "error"
End Select