Anda di halaman 1dari 17

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Range("AF27") = "E-W" Or Range("AF27") = "N-S" Then


Rows("52").EntireRow.Hidden = False
Rows("53").EntireRow.Hidden = True

ElseIf Range("AF27") = "Vertical" Then


Rows("52").EntireRow.Hidden = True
Rows("53").EntireRow.Hidden = False
Else

End If

End Sub

Sub CLAMP_Click()
MSG = MsgBox("DO YOU WANT TO REFRESH CLAMP DATA OR RETRY WITH EXISTING
DATA.", vbYesNo, "REFRESH CLAMP DATA")

If MSG = vbYes Then

Range("AF54") = ""
Range("AF55") = ""
Sheets("Calculation").Range("AF52") = ""
Sheets("Calculation").Range("AI52") = ""
Sheets("Calculation").Range("AL52") = ""
Sheets("Calculation").Range("AF53") = ""
Sheets("Calculation").Range("AI53") = ""
Sheets("Calculation").Range("AI53") = ""

If Sheets("Calculation").Range("AF27") = "E-W" Or
Sheets("Calculation").Range("AF27") = "N-S" Then
Sheets("Calculation").Rows("52").EntireRow.Hidden = False
Sheets("Calculation").Rows("53").EntireRow.Hidden = True

ElseIf Range("AF27") = "Vertical" Then


Sheets("Calculation").Rows("52").EntireRow.Hidden = True
Sheets("Calculation").Rows("53").EntireRow.Hidden = False
Else

End If

If Sheets("Data").Range("J51").Value > 130000 And


Sheets("Calculation").Range("AF24") = "Carbon Steel" Then
MsgBox "Warning! Clamp Design Load exceeds the Fig. 6202 Working Load. Insert
the Vendor provided data for SPECIAL RESTRAINT CLAMP.", vbExclamation, "CLAMP
DESIGN LOAD"
Sheets("Calculation").Range("AF47") = ""
Sheets("Calculation").Range("AF48") = ""
Sheets("Calculation").Range("AF50") = ""
Sheets("Calculation").Range("AF51") = ""
Sheets("Calculation").Range("AF47").Interior.ColorIndex = 19
Sheets("Calculation").Range("AF48").Interior.ColorIndex = 19
Sheets("Calculation").Range("AF50").Interior.ColorIndex = 19
Sheets("Calculation").Range("AF51").Interior.ColorIndex = 19
Sheets("Calculation").Range("V47:AM48").Font.ColorIndex = 5
Sheets("Calculation").Range("V50:AM51").Font.ColorIndex = 5
Sheets("Calculation").Range("C58") = "Clamp description: FIG. 6202, SPECIAL
RESTRAINT CLAMP"

ElseIf Sheets("Calculation").Range("AF24") = "Carbon Steel" And


Sheets("Calculation").Range("AF25") > 650 Then
MsgBox "Warning! Operating Temperature eceeds Clamp Max. Working Temp.
Insert the Vendor provided data for SPECIAL RESTRAINT CLAMP.", vbExclamation,
"MAXIMUM WORKING TEMPERATURE"
Sheets("Calculation").Range("AF47") = Sheets("Data").Range("J56")
Sheets("Calculation").Range("AF48") = Sheets("Data").Range("R2")
Sheets("Calculation").Range("AF50") = ""
Sheets("Calculation").Range("AF51") = ""
Sheets("Calculation").Range("AF47").Interior.ColorIndex = 34
Sheets("Calculation").Range("AF48").Interior.ColorIndex = 34

Sheets("Calculation").Range("AF50").Interior.ColorIndex = 19
Sheets("Calculation").Range("AF51").Interior.ColorIndex = 19
Sheets("Calculation").Range("V47:AM48").Font.ColorIndex = 1
Sheets("Calculation").Range("V50:AM51").Font.ColorIndex = 5
Sheets("Calculation").Range("C58") = "Clamp description: FIG. 6202, SPECIAL
RESTRAINT CLAMP"

ElseIf Sheets("Calculation").Range("AF24") = "Carbon Steel" And


Sheets("Calculation").Range("AF25") <= 650 And Sheets("Data").Range("AL43") =
"NA" Then
MsgBox "Warning! Clamp data NOT available for requested Pipe size. Insert the
Vendor provided data for SPECIAL RESTRAINT CLAMP.", vbExclamation, "PIPE SIZE"
Sheets("Calculation").Range("AF47") = Sheets("Data").Range("J56")
Sheets("Calculation").Range("AF48") = Sheets("Data").Range("R2")
Sheets("Calculation").Range("AF50") = ""
Sheets("Calculation").Range("AF51") = ""
Sheets("Calculation").Range("AF47").Interior.ColorIndex = 34
Sheets("Calculation").Range("AF48").Interior.ColorIndex = 34
Sheets("Calculation").Range("AF50").Interior.ColorIndex = 19
Sheets("Calculation").Range("AF51").Interior.ColorIndex = 19
Sheets("Calculation").Range("V47:AM48").Font.ColorIndex = 1
Sheets("Calculation").Range("V50:AM51").Font.ColorIndex = 5
Sheets("Calculation").Range("C58") = "Clamp description: FIG. 6202, SPECIAL
RESTRAINT CLAMP"

ElseIf Sheets("Calculation").Range("AF24") = "A335 P22" Then


MsgBox "Warning! Clamp Data NOT available in Cataloge. Insert the Vendor
provided data FOR ALLOY CLAMP.", vbExclamation, "ALLOY RESTRAINT CLAMP"
Sheets("Calculation").Range("AF47") = Sheets("Data").Range("J56")

Sheets("Calculation").Range("AF48") = Sheets("Data").Range("R2")
Sheets("Calculation").Range("AF50") = ""
Sheets("Calculation").Range("AF51") = ""
Sheets("Calculation").Range("AF47").Interior.ColorIndex = 34
Sheets("Calculation").Range("AF48").Interior.ColorIndex = 34
Sheets("Calculation").Range("AF50").Interior.ColorIndex = 19
Sheets("Calculation").Range("AF51").Interior.ColorIndex = 19
Sheets("Calculation").Range("V47:AM48").Font.ColorIndex = 1
Sheets("Calculation").Range("V50:AM51").Font.ColorIndex = 5
Sheets("Calculation").Range("C58") = "Clamp description: FIG. 6222, ALLOY
RESTRAINT CLAMP"

ElseIf Sheets("Calculation").Range("AF24") = "A335 P91" Then


MsgBox "Warning! Clamp Data NOT available in Cataloge. Insert the
Vendor provided data for PECIAL ALLOY CLAMP.", vbExclamation, "SPECIAL ALLOY
RESTRAINT CLAMP"
Sheets("Calculation").Range("AF47") = Sheets("Data").Range("J56")
Sheets("Calculation").Range("AF48") = Sheets("Data").Range("R2")
Sheets("Calculation").Range("AF50") = ""
Sheets("Calculation").Range("AF51") = ""
Sheets("Calculation").Range("AF47").Interior.ColorIndex = 34
Sheets("Calculation").Range("AF48").Interior.ColorIndex = 34
Sheets("Calculation").Range("AF50").Interior.ColorIndex = 19
Sheets("Calculation").Range("AF51").Interior.ColorIndex = 19
Sheets("Calculation").Range("V47:AM48").Font.ColorIndex = 1
Sheets("Calculation").Range("V50:AM51").Font.ColorIndex = 5
Sheets("Calculation").Range("C58") = "Clamp description: FIG. 6222,
SPECIAL ALLOY RESTRAINT CLAMP"

Else
Sheets("Calculation").Range("AF47") = Sheets("Data").Range("J56")
Sheets("Calculation").Range("AF48") = Sheets("Data").Range("R2")
Sheets("Calculation").Range("AF50") = Sheets("Data").Range("AL43")
Sheets("Calculation").Range("AF51") = Sheets("Data").Range("AL44")
Sheets("Calculation").Range("AF47").Interior.ColorIndex = 34
Sheets("Calculation").Range("AF48").Interior.ColorIndex = 34
Sheets("Calculation").Range("AF50").Interior.ColorIndex = 34
Sheets("Calculation").Range("AF51").Interior.ColorIndex = 34
Sheets("Calculation").Range("V47:AM48").Font.ColorIndex = 1
Sheets("Calculation").Range("V50:AM51").Font.ColorIndex = 1
Sheets("Calculation").Range("C58") = "Clamp description: FIG. 6202,
CARBON STEEL RESTRAINT CLAMP"

End If

End If
End Sub

Sub Strut()

Dim LS As Range, P As Range, Fig As Range

Set LS = Sheets("Data").Range("J56")
Set P = Sheets("Data").Range("E31")
Set Fig = Sheets("Calculation").Range("AF55")

Select Case LS

Case 0.7
If P = "NA" Then
Sheets("Calculation").Range("AF54") = ""
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf P < 10.75 Then
MsgBox "Calculated P-P length is less than Catalogue MIN length. Increase 'L' or
'H'.", vbExclamation, "STRUT FIG. NO."
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf 10.75 <= P And P <= 33 Then
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = 2015
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2015, LIGHT
DUTY RIGID ROD STRUT"
ElseIf 33 < P And P <= 112 Then

Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250,
ADJUSTABLE RIGID STRUT"
ElseIf P > 112 Then
MsgBox "Calculated P-P length exceeds Catalogue MAX length. Decrease
'L' / 'H' OR Contact Vendor for SPECIAL STRUT.", vbRetryCancel, "STRUT FIG. NO."
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250,
SPECIAL ADJUSTABLE RIGID STRUT"
Else
End If
Case 1.5
If P = "NA" Then
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf P < 10.75 Then
MsgBox "Calculated P-P length is less than Catalogue MIN length. Increase 'L' or
'H'.", vbExclamation, "STRUT FIG. NO."
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf 10.75 <= P And P <= 33 Then
Fig = 2015
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2015, LIGHT
DUTY RIGID ROD STRUT"
ElseIf 33 < P And P <= 112 Then
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")

Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250,
ADJUSTABLE RIGID STRUT"
ElseIf P > 112 Then
MsgBox "Calculated P-P length exceeds Catalogue MAX length. Decrease
'L' / 'H' OR Contact Vendor for SPECIAL STRUT.", vbRetryCancel, "STRUT FIG. NO."
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250,
SPECIAL ADJUSTABLE RIGID STRUT"
Else
End If

Case 4
If P = "NA" Then
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf P < 13.25 Then
MsgBox "Calculated P-P length is less than Catalogue MIN length. Increase 'L' or
'H'.", vbExclamation, "STRUT FIG. NO."
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf 13.25 <= P And P <= 36 Then
Fig = 2015
ElseIf 36 < P And P <= 120 Then
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = 2250

Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250,


ADJUSTABLE RIGID STRUT"
ElseIf P > 120 Then
MsgBox "Calculated P-P length exceeds Catalogue MAX length. Decrease
'L' / 'H' OR Contact Vendor for SPECIAL STRUT.", vbRetryCancel, "STRUT FIG. NO."
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250,
SPECIAL ADJUSTABLE RIGID STRUT"
Else
End If

Case 7
If P = "NA" Then
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf P < 26 Then
MsgBox "Calculated P-P length is less than Catalogue MIN length. Increase 'L' or
'H'.", vbExclamation, "STRUT FIG. NO."
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf 26 <= P And P <= 120 Then
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250,
ADJUSTABLE RIGID STRUT"
ElseIf P > 120 Then

MsgBox "Calculated P-P length exceeds Catalogue MAX length. Decrease 'L' /
'H' OR Contact Vendor for SPECIAL STRUT.", vbRetryCancel, "STRUT FIG. NO."
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250, SPECIAL
ADJUSTABLE RIGID STRUT"
Else
End If

Case 12
If P = "NA" Then
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf P < 26 Then
MsgBox "Calculated P-P length is less than Catalogue MIN length. Increase 'L' or
'H'.", vbExclamation, "STRUT FIG. NO."
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf 26 <= P And P <= 120 Then
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250,
ADJUSTABLE RIGID STRUT"
ElseIf P > 120 Then
MsgBox "Calculated P-P length exceeds Catalogue MAX length. Decrease 'L' /
'H' OR Contact Vendor for SPECIAL STRUT.", vbRetryCancel, "STRUT FIG. NO."
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250, SPECIAL
ADJUSTABLE RIGID STRUT"

Else
End If

Case 25
If P = "NA" Then
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf P < 28 Then
MsgBox "Calculated P-P length is less than Catalogue MIN length. Increase 'L' or
'H'.", vbExclamation, "STRUT FIG. NO."
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf 28 <= P And P <= 120 Then
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250,
ADJUSTABLE RIGID STRUT"
ElseIf P > 120 Then
MsgBox "Calculated P-P length exceeds Catalogue MAX length. Decrease 'L' /
'H' OR Contact Vendor for SPECIAL STRUT.", vbRetryCancel, "STRUT FIG. NO."
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250, SPECIAL
ADJUSTABLE RIGID STRUT"
Else
End If

Case 35

If P = "NA" Then
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf P < 32 Then
MsgBox "Calculated P-P length is less than Catalogue MIN length. Increase 'L' or
'H'.", vbExclamation, "STRUT FIG. NO."
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf 32 <= P And P <= 120 Then
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250,
ADJUSTABLE RIGID STRUT"
ElseIf P > 120 Then
MsgBox "Calculated P-P length exceeds Catalogue MAX length. Decrease 'L' /
'H' OR Contact Vendor for SPECIAL STRUT.", vbRetryCancel, "STRUT FIG. NO."
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250, SPECIAL
ADJUSTABLE RIGID STRUT"
Else
End If

Case 60
If P = "NA" Then
Fig = ""
Sheets("Calculation").Range("C59") = ""

ElseIf P < 34 Then


MsgBox "Calculated P-P length is less than Catalogue MIN length. Increase 'L' or
'H'.", vbExclamation, "STRUT FIG. NO."
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf 34 <= P And P <= 120 Then
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250,
ADJUSTABLE RIGID STRUT"
ElseIf P > 120 Then
MsgBox "Calculated P-P length exceeds Catalogue MAX length. Decrease 'L' /
'H' OR Contact Vendor for SPECIAL STRUT.", vbRetryCancel, "STRUT FIG. NO."
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250, SPECIAL
ADJUSTABLE RIGID STRUT"
Else
End If

Case 80
If P = "NA" Then
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf P < 38 Then
MsgBox "Calculated P-P length is less than Catalogue MIN length. Increase 'L' or
'H'.", vbExclamation, "STRUT FIG. NO."

Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf 38 <= P And P <= 120 Then
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250,
ADJUSTABLE RIGID STRUT"
ElseIf P > 120 Then
MsgBox "Calculated P-P length exceeds Catalogue MAX length. Decrease 'L' /
'H' OR Contact Vendor for SPECIAL STRUT.", vbRetryCancel, "STRUT FIG. NO."
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250, SPECIAL
ADJUSTABLE RIGID STRUT"
Else
End If

Case 130
If P = "NA" Then
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf P < 44 Then
MsgBox "Calculated P-P length is less than Catalogue MIN length. Increase 'L' or
'H'.", vbExclamation, "STRUT FIG. NO."
Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = ""
Sheets("Calculation").Range("C59") = ""
ElseIf 44 <= P And P <= 120 Then

Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250,
ADJUSTABLE RIGID STRUT"
ElseIf P > 120 Then
MsgBox "Calculated P-P length exceeds Catalogue MAX length. Decrease 'L' /
'H' OR Contact Vendor for SPECIAL STRUT.", vbRetryCancel, "STRUT FIG. NO."
Fig = 2250
Sheets("Calculation").Range("C59") = "Strut description: FIG. 2250, SPECIAL
ADJUSTABLE RIGID STRUT"
Else
End If

Sheets("Calculation").Range("AF54") = Sheets("Data").Range("D32")
Sheets("Calculation").Range("AF55") = Fig

End Select

End Sub