by Ravichandran (2 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 6th May 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Expansion rate calculation
Call calculate
End Sub
Private Sub UserForm_Initialize()
'Open "d:\ravi\Coeff_table" For Input As 1
Ucode = 1
Sheets("CoeffTable").Select
For i = 0 To 15
MatlList(i) = Cells(i + 1, 2).Value
'Input #1, MatlList(i)
MaterialList.AddItem MatlList(i)
For j = 0 To 73
Alpha(j, i) = Cells(18 + j, i + 2).Value
'Input #1, Alpha(j, i)
Next
Next
'Close 1
Sheets("AMOC").Select
Call calculate
End Sub
Private Sub X_Click()
End Sub
Private Sub calculate()
OutRange.Caption = " "
Select Case Ucode
Case 1
X = T1.Value * 9 / 5 + 32
Xa = T2.Value * 9 / 5 + 32
K = 1 / 1.2
Case 2
X = T1.Value
Xa = T2.Value
K = 1
End Select
N1 = Int((X + 325) / 25)
N2 = N1 + 1
If N1 > 72 Then GoTo 10
If N1 < 0 Then GoTo 10
Y1 = Alpha(N1, MaterialList.ListIndex)
Y2 = Alpha(N2, MaterialList.ListIndex)
If (Y1 = "-") Or (Y2 = "-") Then GoTo 10
Y = Y1 + (Y2 - Y1) * (X Mod 25) / 25
N1a = Int((Xa + 325) / 25)
N2a = N1a + 1
If N1a > 72 Then GoTo 10
If N1a < 0 Then GoTo 10
Y1a = Alpha(N1a, MaterialList.ListIndex)
Y2a = Alpha(N2a, MaterialList.ListIndex)
If (Y1a = "-") Or (Y2a = "-") Then GoTo 10
Ya = Y1a + (Y2a - Y1a) * (Xa Mod 25) / 25
c = (Y - Ya) * K
Coeff.Value = Format(c, "####0.000")
Select Case Ucode
Case 1
ExpValue.Value = Format(c * StLength.Value, "####0.000")
Case 2
ExpValue.Value = Format(c * StLength.Value / 100, "####0.000")
End Select
GoTo 11
10 Call Error
11 End Sub
Private Sub Error()
ExpValue.Value = "***"
Coeff.Value = "***"
OutRange.Caption = "Temperature Out of Range"
End Sub