Hallo Hay,
ich hoffe, dass ich es richtig eingefügt habe. DANKE!
Stefan
Dim a As Double
Dim b As Double
Dim c As Double
Dim d As Double
Dim e As Double
'Textboxen nur die Eingabe von: "0-9" und "," und und "-"
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57, 44, 45
Case Else: KeyAscii = 0
End Select
End Sub
Private Sub TextBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57, 44, 45
Case Else: KeyAscii = 0
End Select
End Sub
Private Sub TextBox3_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57, 44, 45
Case Else: KeyAscii = 0
End Select
End Sub
Private Sub TextBox4_Change()
End Sub
Private Sub TextBox6_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57, 44, 45
Case Else: KeyAscii = 0
End Select
End Sub
Private Sub TextBox7_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57, 44, 45
Case Else: KeyAscii = 0
End Select
End Sub
Private Sub TextBox8_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57, 44, 45
Case Else: KeyAscii = 0
End Select
End Sub
Private Sub TextBox9_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57, 44, 45
Case Else: KeyAscii = 0
End Select
End Sub
Private Sub TextBox10_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57, 44, 45
Case Else: KeyAscii = 0
End Select
End Sub
Private Sub TextBox11_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57, 44, 45
Case Else: KeyAscii = 0
End Select
End Sub
Private Sub TextBox12_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57, 44, 45
Case Else: KeyAscii = 0
End Select
End Sub
Private Sub TextBox13_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57, 44, 45
Case Else: KeyAscii = 0
End Select
End Sub
Private Sub TextBox14_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57, 44, 45
Case Else: KeyAscii = 0
End Select
End Sub
Private Sub CommandButton1_Click()
If Me.TextBox1.Value = "" Then
MsgBox "Bitte spez. Wärmekapazität cp eingeben" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox1.Value 5 Then
MsgBox "spez. Wärmekapazität cp muss zwischen 0 und 5 kJ/kg*K liegen!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox2.Value = "" Then
MsgBox "Bitte spez. Wärmekapazität cv eingeben!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox2.Value 5 Then
MsgBox "spez. Wärmekapazität cv muss zwischen 0 und 5 kJ/kg*K liegen!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox3.Value = "" Then
MsgBox "Bitte innerer Wirkungsgrad eingeben!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox3.Value 1 Then
MsgBox "innerer Wirkungsgrad muss zwischen 0 und 1 liegen!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox6.Value = "" Then
MsgBox "Bitte Eingangsdruck vor WÜ eingeben!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox6.Value 80 Then
MsgBox "Eingangsdruck vor WÜ muss zwischen 0 und 80 bar liegen!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox7.Value = "" Then
MsgBox "Bitte Ausgangsdruck nach EXP eingeben!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox7.Value 80 Then
MsgBox "Ausgangsdruck nach EXP muss zwischen 0 und 80 bar liegen!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox8.Value = "" Then
MsgBox "Bitte Gastemperatur vor WÜ eingeben!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox8.Value 293 Then
MsgBox "Gastemperatur vor WÜ muss zwischen 273 und 293 K liegen!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox9.Value = "" Then
MsgBox "Bitte Gastemperatur nach EXP eingeben!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox9.Value 293 Then
MsgBox "Gastemperatur nach EXP muss zwischen 253 und 293 K liegen!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox10.Value = "" Then
MsgBox "Bitte spez. Gaskonstante eingeben!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox10.Value 1 Then
MsgBox "spez. Gaskonstante muss zwischen 0 und 1 kJ/kg*K liegen!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox11.Value = "" Then
MsgBox "Bitte Volumenstrom eingeben!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox11.Value 200000 Then
MsgBox "Volumenstrom muss zwischen 0 und 200000 Nm³/h liegen!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox12.Value = "" Then
MsgBox "Bitte Dichte eingeben!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox12.Value 2 Then
MsgBox "Dichte muss zwischen 0 und 2 kg/Nm³ liegen!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox13.Value = "" Then
MsgBox "Bitte Generatorwirkungsgrad eingeben!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox13.Value 1 Then
MsgBox "Generatorwirkungsgrad muss zwischen 0 und 1 liegen!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox14.Value = "" Then
MsgBox "Bitte Wirkungsgrad WÜ eingeben!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox14.Value 1 Then
MsgBox "Wirkungsgrad WÜ muss zwischen 0 und 1 liegen!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox21.Value = "" Then
MsgBox "Bitte mechanischer Wirkungsgrad eingeben!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
If Me.TextBox14.Value 1 Then
MsgBox "mechanischer Wirkungsgrad muss zwischen 0 und 1 liegen!" _
, vbOKOnly, "Achtung!"
Exit Sub
End If
a = Me.TextBox1.Value
b = Me.TextBox2.Value
c = Me.TextBox3.Value
d = Me.TextBox6.Value
e = Me.TextBox7.Value
f = Me.TextBox8.Value
g = Me.TextBox9.Value
h = Me.TextBox10.Value
i = Me.TextBox11.Value
j = Me.TextBox12.Value
k = Me.TextBox13.Value
l = Me.TextBox14.Value
r = Me.TextBox21.Value
m = a / b
n = m * 0.92 + 0.23 * (c - 0.7) + 0.0012 * (d / e)
o = g * (d / e) ^ ((n - 1) / n)
p = 1 - 0.2 * ((1 - ((o - 273) / 200)) ^ 0.5) * d / 75
q = ((i / 3600) * j * h * o * p * (m / (m - 1))) * (((e / d) ^ ((m - 1) / m) - 1)) * c * r
s = q * k
t = (i / 3600) * j * a * (o - f)
u = t / l
v = -1 * s / u
End Sub
Public Function Round(ByVal Number As Double, ByVal Digits As Integer) As Double
Round = Int(Number * 10 ^ Digits + 0.5) / 10 ^ Digits
End Function
Me.TextBox4.Value = m
Me.TextBox5.Value = n
Me.TextBox15.Value = o
Me.TextBox16.Value = p
Me.TextBox17.Value = q
Me.TextBox18.Value = s
Me.TextBox19.Value = u
Me.TextBox20.Value = v
Label4.Visible = True
Label5.Visible = True
Label24.Visible = True
Label25.Visible = True
Label26.Visible = True
Label27.Visible = True
Label28.Visible = True
Label29.Visible = True
Label31.Visible = False
Label32.Visible = False
Label33.Visible = False
Label34.Visible = False
TextBox4.Visible = True
TextBox5.Visible = True
TextBox15.Visible = True
TextBox16.Visible = True
TextBox17.Visible = True
TextBox18.Visible = True
TextBox19.Visible = True
TextBox20.Visible = True
CommandButton2.Visible = True
Range("C4:C5").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
MsgBox "Die Generatorleistung beträgt Value = x und der Gesamtwirkungsgrad Value = y" _
, vbOKOnly, "Zusammenfassung"
End Function
Private Sub CommandButton2_Click()
Me.Hide
End Sub
Private Sub UserForm_Click()
End Sub