Case Is Problem
14.08.2018 18:57:48
Fabian
ich habe folgendes Problem mit einem Case Is , welches eine Kombobox ausliest und den Inhalt mit einer tabelle vergleicht. Bei Übereinstimmung soll in einer weitern Spalte ein Wert in ein Textfeld übernommen werden.
txtrate ist allerding immer leer bzw. lngColumn übernimmt den Wert der Übereinstimmung nicht.
Gruß
Fab
Private Sub cmdpricecalc_Click() 'Preisberechnung Luftfrachtrate*frachtpflichtiges Gewicht
Dim lngColumn As Long
Dim lngrate As Double
Dim lngweight As Double
With ThisWorkbook.Worksheets("Luftfrachtgewicht")
Select Case cboAirlines
Case Is = .Cells(1, 9)
lngColumn = 1
Case Is = .Cells(2, 9)
lngColumn = 2
Case Is = .Cells(3, 9)
lngColumn = 3
Case Is = .Cells(4, 9)
lngColumn = 4
Case Is = .Cells(5, 9)
lngColumn = 5
Case Is = .Cells(6, 9)
lngColumn = 6
Case Is = .Cells(7, 9)
lngColumn = 7
Case Is = .Cells(8, 9)
lngColumn = 8
Case Is = .Cells(9, 9)
lngColumn = 9
Case Is = .Cells(10, 9)
lngColumn = 10
End Select
txtrate = .Cells(10, lngColumn)
End With
lngrate = CDbl(txtrate.Value)
lngweight = CDbl(txtErgebnis.Value)
txtprice = lngrate * lngweight
End Sub