Thema Datum  Von Nutzer Rating
Antwort
Rot VBA Code
12.08.2009 14:54:25 Dieminger Wilhelm
NotSolved
12.08.2009 18:41:00 Holger
NotSolved
13.08.2009 07:24:22 Dieminger Wilhelm
NotSolved

Ansicht des Beitrags:
Von:
Dieminger Wilhelm
Datum:
12.08.2009 14:54:25
Views:
1767
Rating: Antwort:
  Ja
Thema:
VBA Code
Hallo, wer kann mir bei folgendem Problem Helfen:

Ich habe eine Excel-Arbeitsmappe mit mehreren Tabellen. Beim Öffnen der Arbeitsmappe werden 2 CommandButton gestartet. Mit dem zweiten CommandButton möchte ich - sowie wie auch beim ersten - ein UserForm öffnen (funktioniert auch) und in dem Userform die Daten aus der Tabelle3 einlesen (fuktioniert nicht). Der vorhandene Code sieht wie folgt aus:
Option Explicit

Private Sub ComboBox2_Click()
ActiveWorkbook.Worksheets(3).Select
If ComboBox2.ListIndex <> 0 Then
TextBox11 = Cells(ComboBox2.ListIndex + 1, 1)
TextBox12 = Cells(ComboBox2.ListIndex + 1, 2)
TextBox13 = Cells(ComboBox2.ListIndex + 1, 3)
TextBox14 = Cells(ComboBox2.ListIndex + 1, 4)
Else
TextBox11 = ""
TextBox12 = ""
TextBox13 = ""
TextBox14 = ""

End If
End Sub

Private Sub CommandButton4_Click()
If ComboBox2.ListIndex > 0 Then
Rows(ComboBox2.ListIndex + 1).Delete
TextBox11 = ""
TextBox12 = ""
TextBox13 = ""
TextBox14 = ""
UserForm2_Initialize
End If
End Sub

Private Sub CommandButton5_Click()
Dim xZeile As Long
If TextBox1 = "" Then Exit Sub
If ComboBox2.ListIndex = 0 Then
xZeile = [A65536].End(xlUp).Row + 1
Else
xZeile = ComboBox2.ListIndex + 1
End If
Cells(xZeile, 1) = TextBox11
Cells(xZeile, 2) = TextBox12
Cells(xZeile, 3) = TextBox13
Cells(xZeile, 4) = TextBox14
TextBox11 = ""
TextBox12 = ""
TextBox13 = ""
TextBox14 = ""

Columns("A:C").Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
UserForm_Initialize
End Sub

Private Sub CommandButton6_Click()
Unload Me
End Sub

Private Sub Label6_Click()

End Sub

Private Sub TextBox4_Change()

End Sub

Private Sub UserForm_Initialize()
Dim aRow, i As Long
Application.EnableEvents = False
ComboBox2.Clear
aRow = [A65536].End(xlUp).Row
ComboBox2.AddItem "neue Person hinzufügen"
For i = 2 To aRow
ComboBox2.AddItem Cells(i, 1) & ", " & Cells(i, 2)
Next i
ComboBox2.ListIndex = 0
Application.EnableEvents = True

End Sub

Danke für jegliche Hilfe!

Gruß,
Wilhelm

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
Rot VBA Code
12.08.2009 14:54:25 Dieminger Wilhelm
NotSolved
12.08.2009 18:41:00 Holger
NotSolved
13.08.2009 07:24:22 Dieminger Wilhelm
NotSolved