Private
Sub
optbottom_Click()
With
Worksheets(
"Vsl details"
)
Me
.txttotalcosts =
""
If
Me
.optbottom
And
Not
Me
.optsides
And
Me
.cboVslName.ListIndex > -1
Then
Me
.txtcleaningtime = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:L"
), 12,
False
),
"0.00"
)
Me
.txthireloss = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:O"
), 15,
False
),
"0.00"
)
Me
.txtcleaningcosts =
""
ElseIf
Me
.optsides
And
Not
Me
.optbottom
And
Me
.cboVslName.ListIndex > -1
Then
Me
.txtcleaningtime = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:M"
), 13,
False
),
"0.00"
)
Me
.txthireloss = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:P"
), 16,
False
),
"0.00"
)
Me
.txtcleaningcosts = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:R"
), 18,
False
),
"0.00"
)
ElseIf
Me
.optbottom
And
Me
.optsides
And
Me
.cboVslName.ListIndex > -1
Then
Me
.txtcleaningtime = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:N"
), 14,
False
),
"0.00"
)
Me
.txthireloss = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:Q"
), 17,
False
),
"0.00"
)
Me
.txtcleaningcosts = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:S"
), 19,
False
),
"0.00"
)
Else
Me
.txtcleaningtime =
""
Me
.txthireloss =
""
Me
.txtcleaningcosts =
""
Me
.txttotalcosts =
""
End
If
End
With
End
Sub
Private
Sub
optsides_Click()
With
Worksheets(
"Vsl details"
)
Me
.txttotalcosts =
""
If
Me
.optsides
And
Not
Me
.optbottom
And
Me
.cboVslName.ListIndex > -1
Then
Me
.txtcleaningtime = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:M"
), 13,
False
),
"0.00"
)
Me
.txthireloss = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:P"
), 16,
False
),
"0.00"
)
Me
.txtcleaningcosts = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:R"
), 18,
False
),
"0.00"
)
ElseIf
Me
.optbottom
And
Not
Me
.optsides
And
Me
.cboVslName.ListIndex > -1
Then
Me
.txtcleaningtime = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:L"
), 12,
False
),
"0.00"
)
Me
.txthireloss = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:O"
), 15,
False
),
"0.00"
)
Me
.txtcleaningcosts =
""
ElseIf
Me
.optsides
And
Me
.optbottom
And
Me
.cboVslName.ListIndex > -1
Then
Me
.txtcleaningtime = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:N"
), 14,
False
),
"0.00"
)
Me
.txthireloss = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:Q"
), 17,
False
),
"0.00"
)
Me
.txtcleaningcosts = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:T"
), 20,
False
),
"0.00"
)
Else
Me
.txtcleaningtime =
""
Me
.txthireloss =
""
Me
.txtcleaningcosts =
""
Me
.txttotalcosts =
""
End
If
End
With
End
Sub
Private
Sub
cboVslName_Change()
With
Worksheets(
"Vsl details"
)
If
Me
.cboVslName =
""
Then
Me
.txtcleaningtime =
""
Me
.txthireloss =
""
Me
.txtcleaningcosts =
""
Me
.txttotalcosts =
""
Exit
Sub
End
If
Me
.txttotalcosts =
""
If
Me
.optbottom
And
Not
Me
.optsides
Then
Me
.txtcleaningtime = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:L"
), 12,
False
),
"0.00"
)
Me
.txthireloss = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:O"
), 15,
False
),
"0.00"
)
Me
.txtcleaningcosts =
""
ElseIf
Me
.optsides
And
Not
Me
.optbottom
Then
Me
.txtcleaningtime = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:M"
), 13,
False
),
"0.00"
)
Me
.txthireloss = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:P"
), 16,
False
),
"0.00"
)
Me
.txtcleaningcosts = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:R"
), 18,
False
),
"0.00"
)
ElseIf
Me
.optbottom
And
Me
.optsides
Then
Me
.txtcleaningtime = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:N"
), 14,
False
),
"0.00"
)
Me
.txthireloss = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:Q"
), 17,
False
),
"0.00"
)
Me
.txtcleaningcosts = Format(WorksheetFunction.VLookup(
Me
.cboVslName, .Range(
"A:T"
), 20,
False
),
"0.00"
)
End
If
End
With
End
Sub
Private
Sub
cmdCalculate_Click()
If
Not
Me
.optbottom
And
Not
Me
.optsides
Then
MsgBox
"Es wurde keine Auswahl getroffen."
Exit
Sub
End
If
If
Me
.optbottom
And
Not
Me
.optsides
And
Me
.cboVslName.ListIndex > -1
Then
Me
.txttotalcosts = Format(
CDbl
(
Me
.txthireloss),
"0.00"
)
ElseIf
Me
.optbottom
And
Me
.optsides
And
Me
.cboVslName.ListIndex > -1
Then
Me
.txttotalcosts = Format(
CDbl
(
Me
.txthireloss) +
CDbl
(
Me
.txtcleaningcosts),
"0.00"
)
ElseIf
Me
.optsides
And
Not
optbottom
And
Me
.cboVslName.ListIndex > -1
Then
Me
.txttotalcosts = Format(
CDbl
(
Me
.txthireloss) +
CDbl
(
Me
.txtcleaningcosts),
"0.00"
)
Else
MsgBox
"Bitte ein Schiff auswählen."
End
If
End
Sub