Thema Datum  Von Nutzer Rating
Antwort
15.01.2018 18:44:09 Olli
Solved
16.01.2018 14:19:31 Werner
NotSolved
16.01.2018 15:18:08 Gast22849
NotSolved
16.01.2018 17:29:25 Werner
NotSolved
16.01.2018 20:08:26 Olli
NotSolved
17.01.2018 07:29:39 Gast77180
NotSolved
17.01.2018 11:36:35 Olli
NotSolved
17.01.2018 19:45:47 Gast78391
NotSolved
17.01.2018 20:20:02 Werner
NotSolved
Blau Werte aus einem Dropdownmenü mit Zellen kombinieren
18.01.2018 18:08:16 Olli
NotSolved
18.01.2018 18:52:27 Werner
NotSolved
19.01.2018 18:06:22 Gast3406
NotSolved
19.01.2018 18:40:00 Werner
NotSolved
19.01.2018 18:49:19 Gast42753
NotSolved
19.01.2018 18:57:53 Werner
Solved
20.01.2018 11:50:51 Gast71831
NotSolved

Ansicht des Beitrags:
Von:
Olli
Datum:
18.01.2018 18:08:16
Views:
559
Rating: Antwort:
  Ja
Thema:
Werte aus einem Dropdownmenü mit Zellen kombinieren

Hallo Werner,

 

habe deinen Code wie folgt an meine Benennungen angepasst. Musste noch eine Spalten des Ausgangsmaterials ändern bzw hinzufügen:

Private Sub optbottom_Click()

'Textbox1 = txtcleaningtime
'TExtbox2 = txthireloss
'textbox3 = txtcleaningcosts
'TExtbox4 = txttotalcosts

'Checkbox1 = optbottom
'Checkbox2 = optsides
'ComboBox1 = cboVslName
 
With Worksheets("Vsl details") 'Blattname anpassen
    Me.txttotalcosts = ""
        'Daten aus Spalte L (cleaning flat bottom) in Textbox
        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")
            'Daten aus Spalte O (hire loss for cleaning flat bottom) in Textbox 2
            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
            'Daten aus Spalte M in txtcleaningtime
            Me.txtcleaningtime = Format(WorksheetFunction.VLookup(Me.cboVslName, .Range("A:M"), 13, False), "0.00")
            'Daten aus Spalte P in txthireloss
            Me.txthireloss = Format(WorksheetFunction.VLookup(Me.cboVslName, .Range("A:P"), 16, False), "0.00")
            'Daten aus Spalte R in txtcleaningcosts
            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
            'Daten aus Spalte N in txtcleaningtime
            Me.txtcleaningtime = Format(WorksheetFunction.VLookup(Me.cboVslName, .Range("A:N"), 14, False), "0.00")
            'Daten aus Spalte Q in txthireloss
            Me.txthireloss = Format(WorksheetFunction.VLookup(Me.cboVslName, .Range("A:Q"), 17, False), "0.00")
            'Daten aus Spalte T in txtcleaningcosts
            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()
'Textbox1 = txtcleaningtime
'TExtbox2 = txthireloss
'textbox3 = txtcleaningcosts
'TExtbox4 = txttotalcosts

'Checkbox1 = optbottom
'Checkbox2 = optsides
'ComboBox1 = cboVslName
 
With Worksheets("Vsl details") 'Blattname anpassen
    Me.txttotalcosts = ""
    If Me.optsides And Not Me.optbottom And Me.cboVslName.ListIndex > -1 Then
        'Daten aus Spalte M in Textbox1
        Me.txtcleaningtime = Format(WorksheetFunction.VLookup(Me.cboVslName, .Range("A:M"), 13, False), "0.00")
        'Daten aus Spalte P in Textbox2
        Me.txthireloss = Format(WorksheetFunction.VLookup(Me.cboVslName, .Range("A:P"), 16, False), "0.00")
        'Daten aus Spalte R in Textbox3
        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")
        'Daten aus Spalte O in Textbox
        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
        'Daten aus Spalte N in Textbox1
        Me.txtcleaningtime = Format(WorksheetFunction.VLookup(Me.cboVslName, .Range("A:N"), 14, False), "0.00")
        'Daten aus Spalte Q in Textbox2
        Me.txthireloss = Format(WorksheetFunction.VLookup(Me.cboVslName, .Range("A:Q"), 17, False), "0.00")
        'Daten aus Spalte T in Textbox3
        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()
'Textbox1 = txtcleaningtime
'TExtbox2 = txthireloss
'textbox3 = txtcleaningcosts
'TExtbox4 = txttotalcosts


'Checkbox1 = optbottom
'Checkbox2 = optsides
'ComboBox1 = cboVslName
 
With Worksheets("Vsl details") 'Blattname anpassen
    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
        'Daten aus Spalte L in Textbox1
        Me.txtcleaningtime = Format(WorksheetFunction.VLookup(Me.cboVslName, .Range("A:L"), 12, False), "0.00")
        'Daten aus Spalte O in Textbox2
        Me.txthireloss = Format(WorksheetFunction.VLookup(Me.cboVslName, .Range("A:O"), 15, False), "0.00")
        Me.txtcleaningcosts = ""
    ElseIf Me.optsides And Not Me.optbottom Then
        'Daten aus Spalte M in Textbox1
        Me.txtcleaningtime = Format(WorksheetFunction.VLookup(Me.cboVslName, .Range("A:M"), 13, False), "0.00")
        'Daten aus Spalte P in Textbox2
        Me.txthireloss = Format(WorksheetFunction.VLookup(Me.cboVslName, .Range("A:P"), 16, False), "0.00")
        'Daten aus Spalte R in Textbox3
        Me.txtcleaningcosts = Format(WorksheetFunction.VLookup(Me.cboVslName, .Range("A:R"), 18, False), "0.00")
    ElseIf Me.optbottom And Me.optsides Then
        'Daten aus Spalte N in Textbox1
        Me.txtcleaningtime = Format(WorksheetFunction.VLookup(Me.cboVslName, .Range("A:N"), 14, False), "0.00")
        'Daten aus Spalte Q in Textbox2
        Me.txthireloss = Format(WorksheetFunction.VLookup(Me.cboVslName, .Range("A:Q"), 17, False), "0.00")
        'Daten aus Spalte T in Textbox3
        Me.txtcleaningcosts = Format(WorksheetFunction.VLookup(Me.cboVslName, .Range("A:T"), 20, False), "0.00")
    
    End If
End With
 
End Sub
 
Private Sub cmdCalculate_Click()
'Textbox1 = txtcleaningtime
'TExtbox2 = txthireloss
'textbox3 = txtcleaningcosts
'TExtbox4 = txttotalcosts

'Checkbox1 = optbottom
'Checkbox2 = optsides
'ComboBox1 = cboVslName
 
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")
'End If
ElseIf Me.optbottom And Me.optsides And Me.cboVslName.ListIndex > -1 Then
    Me.txttotalcosts = Format(CDbl(Me.txthireloss) + CDbl(Me.txtcleaningcosts), "0.00")
'End If
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

 

 

Gruß Olli


Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:



  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
15.01.2018 18:44:09 Olli
Solved
16.01.2018 14:19:31 Werner
NotSolved
16.01.2018 15:18:08 Gast22849
NotSolved
16.01.2018 17:29:25 Werner
NotSolved
16.01.2018 20:08:26 Olli
NotSolved
17.01.2018 07:29:39 Gast77180
NotSolved
17.01.2018 11:36:35 Olli
NotSolved
17.01.2018 19:45:47 Gast78391
NotSolved
17.01.2018 20:20:02 Werner
NotSolved
Blau Werte aus einem Dropdownmenü mit Zellen kombinieren
18.01.2018 18:08:16 Olli
NotSolved
18.01.2018 18:52:27 Werner
NotSolved
19.01.2018 18:06:22 Gast3406
NotSolved
19.01.2018 18:40:00 Werner
NotSolved
19.01.2018 18:49:19 Gast42753
NotSolved
19.01.2018 18:57:53 Werner
Solved
20.01.2018 11:50:51 Gast71831
NotSolved