Thema Datum  Von Nutzer Rating
Antwort
Rot Knöpfe zur Navigation in Excel-Datensätzen
11.06.2013 16:05:23 Hegelito
NotSolved

Ansicht des Beitrags:
Von:
Hegelito
Datum:
11.06.2013 16:05:23
Views:
3238
Rating: Antwort:
  Ja
Thema:
Knöpfe zur Navigation in Excel-Datensätzen

Hallo Forum,

ich habe eine UserForm angelegt, mit deren Hilfe Daten aus einer Exceltabelle ausgelesen werden und bearbeitet werden können. Nun würde ich gerne zwei Knöpfe anbringen, die mich nach Auswahl eines Datensatzes aus der ComboBox vor und zurück blättern lassen in den Daten. Ich hänge mal meinen bisherigen Code an, wenn ihr mehr zur Info braucht (Screenshot von der Maske? Exceltabelle?), gebt bitte kurz Bescheid.

Vielen Dank für eure Hilfe. Wenn dann noch zwei Knöpfe realisierbar wären, um zum ersten Datensatz und zum letzten zu gelangen, um so besser!

Dieter

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
Private Sub CommandButton2_Click()
Workbooks("Kläranlagen_neu.xlsm").Close SaveChanges:=True
End Sub
 
Private Sub CommandButton3_Click()
UserForm1.PrintForm
End Sub
 
Private Sub UserForm_Initialize()
Dim aRow, i As Long
Application.EnableEvents = False
ComboBox1.Clear
aRow = [A65536].End(xlUp).Row
ComboBox1.AddItem "neue Person hinzufügen"
For i = 3 To aRow
    ComboBox1.AddItem Cells(i, 5) & ", " & Cells(i, 2)
Next i
ComboBox1.ListIndex = 0
Application.EnableEvents = True
End Sub
 
 
Private Sub ComboBox1_Click()
If ComboBox1.ListIndex <> 0 Then
     
    TextBox2 = Cells(ComboBox1.ListIndex + 2, 1)
    TextBox3 = Cells(ComboBox1.ListIndex + 2, 2)
    TextBox4 = Cells(ComboBox1.ListIndex + 2, 3)
    TextBox5 = Cells(ComboBox1.ListIndex + 2, 4)
    TextBox6 = Cells(ComboBox1.ListIndex + 2, 5)
    TextBox7 = Cells(ComboBox1.ListIndex + 2, 6)
    TextBox8 = Cells(ComboBox1.ListIndex + 2, 7)
    TextBox9 = Cells(ComboBox1.ListIndex + 2, 8)
    TextBox10 = Cells(ComboBox1.ListIndex + 2, 9)
    TextBox11 = Cells(ComboBox1.ListIndex + 2, 10)
    TextBox12 = Cells(ComboBox1.ListIndex + 2, 11)
    TextBox13 = Cells(ComboBox1.ListIndex + 2, 12)
    TextBox15 = Cells(ComboBox1.ListIndex + 2, 14)
    TextBox16 = Cells(ComboBox1.ListIndex + 2, 15)
    TextBox17 = Cells(ComboBox1.ListIndex + 2, 16)
    TextBox18 = Cells(ComboBox1.ListIndex + 2, 17)
     
         
Else
     
    TextBox2 = ""
    TextBox3 = ""
    TextBox4 = ""
    TextBox5 = ""
    TextBox6 = ""
    TextBox7 = ""
    TextBox8 = ""
    TextBox9 = ""
    TextBox10 = ""
    TextBox11 = ""
    TextBox12 = ""
    TextBox13 = ""
    TextBox15 = ""
    TextBox16 = ""
    TextBox17 = ""
    TextBox18 = ""
     
         
End If
End Sub
 
'Übernehmen
 
Private Sub CommandButton1_Click()
 
On Error Resume Next
 
 
Dim xZeile As Long
' If TextBox2 = "" Then Exit Sub
If ComboBox1.ListIndex = 0 Then
' letzte Zeile suchen
 
    xZeile = [B65536].End(xlUp).Row + 1
Else
    xZeile = ComboBox1.ListIndex + 2
End If
Cells(xZeile, 1) = TextBox2
Cells(xZeile, 2) = TextBox3
Cells(xZeile, 3) = TextBox4
Cells(xZeile, 4) = TextBox5
Cells(xZeile, 5) = TextBox6
Cells(xZeile, 6) = TextBox7
Cells(xZeile, 7) = TextBox8
Cells(xZeile, 8) = TextBox9
Cells(xZeile, 9) = TextBox10
Cells(xZeile, 10) = TextBox11
Cells(xZeile, 11) = TextBox12
Cells(xZeile, 12) = TextBox13
Cells(xZeile, 14) = TextBox15
Cells(xZeile, 15) = TextBox16
Cells(xZeile, 16) = TextBox17
Cells(xZeile, 17) = TextBox18
 
 
    TextBox2 = ""
    TextBox3 = ""
    TextBox4 = ""
    TextBox5 = ""
    TextBox6 = ""
    TextBox7 = ""
    TextBox8 = ""
    TextBox9 = ""
    TextBox10 = ""
    TextBox11 = ""
    TextBox12 = ""
    TextBox13 = ""
    TextBox14 = ""
    TextBox15 = ""
    TextBox16 = ""
    TextBox17 = ""
    TextBox18 = ""
     
Dim zeilen As Integer
 
zeilen = Columns(2).End(xlDown).Row
'
' sortieren
'
 
'
    ActiveWorkbook.Worksheets("Tabelle1").ListObjects("Tabelle3").Sort.SortFields. _
        Clear
    ActiveWorkbook.Worksheets("Tabelle1").ListObjects("Tabelle3").Sort.SortFields. _
        Add Key:=Range("E2:E742"), SortOn:=xlSortOnValues, Order:=xlAscending, _
        DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Tabelle1").ListObjects("Tabelle3").Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
 
UserForm_Initialize
End Sub

 


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 Knöpfe zur Navigation in Excel-Datensätzen
11.06.2013 16:05:23 Hegelito
NotSolved