Live-Forum - Die aktuellen Beiträge
Datum
Titel
29.03.2024 13:14:12
28.03.2024 21:12:36
28.03.2024 18:31:49
Anzeige
Archiv - Navigation
908to912
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
908to912
908to912
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Autofilter

Autofilter
28.09.2007 21:49:00
Holger
Hallo Ihr´s,
Mit folgendem Code, öffne ich eine andere Arbeitsmappe und Fülle mit den Daten eine UF:

Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
Workbooks.Open Filename:=Sheets("Daten").Range("J2").Text
If Workbooks("Mappe11").Sheets("Daten").Cells(13, 6) = 1 Then
Sheets("Bew_Dat").Select
Columns("P:P").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="Wohnbereich 1"
With ComboBox1
.RowSource = "Bew_Dat!A2:A1000" & Sheets("Bew_Dat").Cells(Rows.Count, 5).End(xlUp).Row
.ListIndex = Sheets("Bew_Dat").Range("IV2")
With ComboBox6
.RowSource = "KK!A2:A1000" & Sheets("KK").Cells(Rows.Count, 5).End(xlUp).Row
With ComboBox9
.RowSource = "Ärzte!A2:A1000" & Sheets("Ärzte").Cells(Rows.Count, 5).End(xlUp).Row
With ComboBox10
.RowSource = "Ärzte!A2:A1000" & Sheets("Ärzte").Cells(Rows.Count, 5).End(xlUp).Row
End With
End With
End With
End With
Selection.AutoFilter
End If
End Sub


Mit dem IF-Block versuche ich Daten zu Filtern, wie im Code vorhanden, nach "wohnbereich 1". Wenn ich in der "zweiten" Arbeitsmappe nachschaue, werden die Daten auch sauber gefiltert.
JETZT das Problem, in der UF werden aber trotzdem alle Daten angezeigt?
Hat da jemand eine Idee warum das so ist?
Gruß und Dank
Holger

16
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Autofilter
28.09.2007 21:59:00
Hajo_Zi
Hallo Holger,
Du weist ein Adressbereich zu. Du mußt jeden Wert einzeln zuweisen und Prüfen ob Zeilenhöhe > 0

AW: Autofilter
28.09.2007 22:19:00
Holger
Hallo Hajo,
das hab ich jetzt nicht verstanden...kannst Du mir das erklären?
Gruß Holger

gibt es eine andere Möglichkeit?
29.09.2007 01:00:04
Holger
Hallo Ihr,
gibt es denn irgend eine andere Möglichkeit die Daten in die UF, sortiert einzulesen? Ich kann die Daten natürlich, in kopie auf einzelne Datenblätter speichern, und die dann je nach Kriterium auslesen lassen, aber das macht mir die ganze Sache wieder zu langsam, durch den Speichervorgang auf die einzelnen Sheets.
Durch den Autofilter werden die Zeilen nur ausgeblendet, und somit über .rowsource trotzdem eingelesen? Richtig?
Über Hilfe wäre ich echt dankbar.
Gruß Holger

Anzeige
AW: gibt es eine andere Möglichkeit?
29.09.2007 09:41:00
Hajo_Zi
Hallo Holger,
weise die Werte einzeln zu wie schon geschrieben. Mit einer Schleife und Additem
Gruß Hajo

AW: gibt es eine andere Möglichkeit?
29.09.2007 09:49:50
Holger
Hallo Hajo,
Danke für DeineAntwort, leider verstehe ich das nicht wirklich, dafür reicht mein wissen nicht aus, lerne aber gerne dazu, kannst du mir dabei helfen?
Gruß und Dank
Holger

AW: gibt es eine andere Möglichkeit?
29.09.2007 09:52:00
Hajo_Zi
Hallo Holger,
welchen Grund sollte ich haben Den Beispieol nachzubauen? Du hast dafür schon die Zeit investiert.
Gruß Hajo

Anzeige
AW: gibt es eine andere Möglichkeit?
29.09.2007 09:59:00
Holger
Hallo Hajo,
mein Beispiel soll ja nicht nachgebaut werden, ich versteh nur nicht wie ich das in den Code umsetzen kann. Das ist mein Problem.
Gruß Holger

AW: gibt es eine andere Möglichkeit?
29.09.2007 10:09:00
Hajo_Zi
Hallo Holger,
Gut ich kann damit Leben. Dies war mein letzter Beitrag. Du hast ja klar zum Ausdruck gebracht das Du es selber anpassen möchtest.
If Rows(Loi).RowHeight 0 Then ComboBox1.AddItem Cells(Loi, 1)
Gruß Hajo

AW: gibt es eine andere Möglichkeit?
29.09.2007 10:44:00
Holger
Hallo Hajo,
sollte ich die Mappe hochladen, meintest Du das? Dann habe ich Dich nicht verstanden...SORRY. Die Mappe ist aber 432KB groß, und somit leider nicht zum Upload geeignet. Zudem stehen die Daten in einer zweiten Mappe, die schon 2,5MB groß ist. kann ich den Code hier nicht dann besser posten?Mache ich mal einfach, hier der gesamte Code der in meiner UF steht zum Daten einlesen, ändern und wieder abspeichern.
Option Compare Text

Private Sub CommandButton2_Click()
UFTIP1.Show
End Sub



Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
UFStop.Show
Cancel = True
End If
End Sub



Private Sub CommandButton1_Click()
'beenden
ActiveWorkbook.Saved = True
ActiveWorkbook.Close
Unload Me
Application.ScreenUpdating = True
End Sub



Private Sub cmdDelete_Click()
If Bew_bearbeiten.ComboBox1 = "" Then
UFDaten_wählen.Show
Else
Sheets("Bew_Dat").Rows(ComboBox1.ListIndex + 2).Delete
ActiveWorkbook.Save
End If
End Sub



Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
Workbooks.Open Filename:=Sheets("Daten").Range("J2").Text
With ComboBox1
.RowSource = "Bew_Dat!A2:A1000" & Sheets("Bew_Dat").Cells(Rows.Count, 5).End(xlUp).Row
.ListIndex = Sheets("Bew_Dat").Range("IV2")
End With
With ComboBox6
.RowSource = "KK!A2:A1000" & Sheets("KK").Cells(Rows.Count, 5).End(xlUp).Row
With ComboBox9
.RowSource = "Ärzte!A2:A1000" & Sheets("Ärzte").Cells(Rows.Count, 5).End(xlUp).Row
With ComboBox10
.RowSource = "Ärzte!A2:A1000" & Sheets("Ärzte").Cells(Rows.Count, 5).End(xlUp).Row
End With
End With
End With
End Sub



Private Sub ComboBox1_Change()
On Error Resume Next
TextBox2 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 2))
TextBox3 = Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 4)
TextBox4 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 5))
TextBox5 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 33))
TextBox6 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 34))
TextBox7 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 35))
TextBox8 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 36))
TextBox9 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 37))
TextBox10 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 38))
TextBox11 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 39))
TextBox12 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 40))
TextBox13 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 41))
TextBox14 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 42))
TextBox15 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 43))
TextBox16 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 44))
TextBox17 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 18))
TextBox18 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 19))
TextBox19 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 26))
TextBox20 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 27))
TextBox21 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 20))
TextBox22 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 21))
TextBox23 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 22))
TextBox24 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 23))
TextBox25 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 24))
TextBox26 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 28))
TextBox27 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 29))
TextBox28 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 30))
TextBox29 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 31))
TextBox30 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 32))
TextBox31 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 10))
TextBox32 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 11))
TextBox33 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 12))
TextBox34 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 13))
TextBox35 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 14))
TextBox36 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 46))
TextBox37 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 47))
TextBox38 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 48))
TextBox39 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 49))
TextBox40 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 50))
TextBox41 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 51))
TextBox42 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 52))
TextBox43 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 53))
TextBox44 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 54))
ComboBox2 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 3))
ComboBox3 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 6))
ComboBox4 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 7))
ComboBox5 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 8))
ComboBox6 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 9))
ComboBox7 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 15))
ComboBox8 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 16))
ComboBox9 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 17))
ComboBox10 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 25))
ComboBox11 = Format(Sheets("Bew_Dat").Cells(ComboBox1.ListIndex + 2, 45))
End Sub



Private Sub cmdSave_Click()
If Bew_bearbeiten.ComboBox1 = "" Then
UFDaten_wählen.Show
Else
If Bew_bearbeiten.ComboBox8 = "" Then
UFWB.Show
Else
Sheets("Bew_Dat").Select
Worksheets("Bew_Dat").Activate
g = ComboBox1.ListIndex + 2
Cells(g, 2) = TextBox2.Value
Cells(g, 4) = TextBox3.Value
Cells(g, 5) = TextBox4.Value
Cells(g, 33) = TextBox5.Value
Cells(g, 34) = TextBox6.Value
Cells(g, 35) = TextBox7.Value
Cells(g, 36) = TextBox8.Value
Cells(g, 37) = TextBox9.Value
Cells(g, 38) = TextBox10.Value
Cells(g, 39) = TextBox11.Value
Cells(g, 40) = TextBox12.Value
Cells(g, 41) = TextBox13.Value
Cells(g, 42) = TextBox14.Value
Cells(g, 43) = TextBox15.Value
Cells(g, 44) = TextBox16.Value
Cells(g, 18) = TextBox17.Value
Cells(g, 19) = TextBox18.Value
Cells(g, 26) = TextBox19.Value
Cells(g, 27) = TextBox20.Value
Cells(g, 20) = TextBox21.Value
Cells(g, 21) = TextBox22.Value
Cells(g, 22) = TextBox23.Value
Cells(g, 23) = TextBox24.Value
Cells(g, 24) = TextBox25.Value
Cells(g, 28) = TextBox26.Value
Cells(g, 29) = TextBox27.Value
Cells(g, 30) = TextBox28.Value
Cells(g, 31) = TextBox29.Value
Cells(g, 32) = TextBox30.Value
Cells(g, 10) = TextBox31.Value
Cells(g, 11) = TextBox32.Value
Cells(g, 12) = TextBox33.Value
Cells(g, 13) = TextBox34.Value
Cells(g, 14) = TextBox35.Value
Cells(g, 46) = TextBox36.Value
Cells(g, 47) = TextBox37.Value
Cells(g, 48) = TextBox38.Value
Cells(g, 49) = TextBox39.Value
Cells(g, 50) = TextBox40.Value
Cells(g, 51) = TextBox41.Value
Cells(g, 52) = TextBox42.Value
Cells(g, 53) = TextBox43.Value
Cells(g, 54) = TextBox44.Value
Cells(g, 3) = ComboBox2.Value
Cells(g, 6) = ComboBox3.Value
Cells(g, 7) = ComboBox4.Value
Cells(g, 8) = ComboBox5.Value
Cells(g, 9) = ComboBox6.Value
Cells(g, 15) = ComboBox7.Value
Cells(g, 16) = ComboBox8.Value
Cells(g, 17) = ComboBox9.Value
Cells(g, 25) = ComboBox10.Value
Cells(g, 45) = ComboBox11.Value
End If
End If
sort1
ActiveWorkbook.Save
End Sub


'HA


Private Sub ComboBox10_Change()
On Error Resume Next
TextBox17 = Format(Sheets("Ärzte").Cells(ComboBox10.ListIndex + 2, 6))
TextBox18 = Format(Sheets("Ärzte").Cells(ComboBox10.ListIndex + 2, 7))
TextBox21 = Format(Sheets("Ärzte").Cells(ComboBox10.ListIndex + 2, 3))
TextBox22 = Format(Sheets("Ärzte").Cells(ComboBox10.ListIndex + 2, 9))
TextBox23 = Format(Sheets("Ärzte").Cells(ComboBox10.ListIndex + 2, 8))
TextBox24 = Format(Sheets("Ärzte").Cells(ComboBox10.ListIndex + 2, 4))
TextBox25 = Format(Sheets("Ärzte").Cells(ComboBox10.ListIndex + 2, 5))
End Sub


'FA


Private Sub ComboBox9_Change()
On Error Resume Next
TextBox19 = Format(Sheets("Ärzte").Cells(ComboBox9.ListIndex + 2, 6))
TextBox20 = Format(Sheets("Ärzte").Cells(ComboBox9.ListIndex + 2, 7))
TextBox26 = Format(Sheets("Ärzte").Cells(ComboBox9.ListIndex + 2, 3))
TextBox27 = Format(Sheets("Ärzte").Cells(ComboBox9.ListIndex + 2, 9))
TextBox28 = Format(Sheets("Ärzte").Cells(ComboBox9.ListIndex + 2, 8))
TextBox29 = Format(Sheets("Ärzte").Cells(ComboBox9.ListIndex + 2, 4))
TextBox30 = Format(Sheets("Ärzte").Cells(ComboBox9.ListIndex + 2, 5))
End Sub


'KK


Private Sub ComboBox6_Change()
On Error Resume Next
TextBox31 = Format(Sheets("KK").Cells(ComboBox6.ListIndex + 2, 4))
TextBox32 = Format(Sheets("KK").Cells(ComboBox6.ListIndex + 2, 5))
TextBox33 = Format(Sheets("KK").Cells(ComboBox6.ListIndex + 2, 2))
TextBox34 = Format(Sheets("KK").Cells(ComboBox6.ListIndex + 2, 3))
TextBox35 = Format(Sheets("KK").Cells(ComboBox6.ListIndex + 2, 6))
End Sub


Gruß Holger

Anzeige
Lieber Hajo...
29.09.2007 15:00:17
Holger
...wir haben uns da wohl etwas mißverstanden, sorry. Kannst Du mir denn nichtweiterhelfen? Verzweifel grad etwas.
Gruß Holger

AW: gibt es eine andere Möglichkeit?
29.09.2007 18:06:00
Reinhard
Hi Holger,
mach mal Kopien der beiden Dateien, schmeiß 99% unnötiges raus, so daß die zusammen maximal 100 KB groß sind, besser noch weniger, aber noch die gleichen Dateistrukturen haben, den Code, die Userform usw.
und lade die dann hoch.
Und dein Problem:
"JETZT das Problem, in der UF werden aber trotzdem alle Daten angezeigt? "
kann man locker auch mit 3-5 Textboxen usw. nachstellen, dazu brauchts keine 40 Boxen.
In diesem Sinne, kürze mal alles was man für das eigentliche Problem nicht braucht. Code der bei 30 Datenzeilen funktioniert, funktioniert auch bei 30.000 Datenzeilen, also könnnen 29.970 Zeilen wech, jetzt mal so als Hinweis.
Gruß
Reinhard

Anzeige
UPLOAD...habs kapiert!!SORRY
29.09.2007 21:27:00
Holger
Hallo liebe Excelianer,
bin etwas umständlich beim umschreiben und "schwer vonCape" bin ich auch...Danke Reinhard für Deinen Tip hier also mein UPLOAD (habe aus zwei Dateien eine gemacht)
https://www.herber.de/bbs/user/46438.xls
Nochmals mein Problem:
Ich "logge" mich per UF in das Workbook, hier bei schreibe ich Username und Bereich in das Sheet "Daten"
Mit der UF "Bew_Dat" lese ich Klienten Daten aus, kann sie ändern und zurück speichern. Dabei soll der angemeldete User aber nur seinem Bereich zugeordnete Klienten angezeigt bekommen.
Nächstes Fragestellung, mit dem Button "Löschen" - lösche ich bislang unweigerlich alle Klientendaten, ist es möglich dies umzuändern und die Daten in das Sheet "Delete" zu verschieben?
Herzliches Danke SCHÖN im vorraus
Gruß Holger

Anzeige
Kann keiner Helfen?
30.09.2007 20:50:56
Holger
Hallo liebe Spezialisten,
schreibe nochmals weil ichECHT nicht weiter komme...meine Beispielmappe:
https://www.herber.de/bbs/user/46438.xls
Nochmals mein Problem:
Ich "logge" mich per UF in das Workbook, hier bei schreibe ich Username und Bereich in das Sheet "Daten"
Mit der UF "Bew_Dat" lese ich Klienten Daten aus, kann sie ändern und zurück speichern. Dabei soll der angemeldete User aber nur seinem Bereich zugeordnete Klienten angezeigt bekommen.
Nächstes Fragestellung, mit dem Button "Löschen" - lösche ich bislang unweigerlich alle Klientendaten, ist es möglich dies umzuändern und die Daten in das Sheet "Delete" zu verschieben?
Herzliches Danke SCHÖN im vorraus
Gruß Holger

Anzeige
ENDE...eröffne neue Fragestellung,o.T!
01.10.2007 21:20:14
Holger
o.T.

AW: Autofilter
28.09.2007 22:00:00
{Boris}
Hi Holger,
mit
.RowSource = "Bew_Dat!A2:A1000"
legst Du doch bereits einen kompletten Bereich fest. Der Zusatz
& Sheets("Bew_Dat").Cells(Rows.Count, 5).End(xlUp).Row
ist daher unverständlich.
Grüße Boris

AW: Autofilter
28.09.2007 22:20:00
Holger
Hallo Boris,
ja,aber auch wennichden zusatz weglasse funtzt es nicht, Hajo´s Tip vertseh ich leider nicht was er damit meint.
Gruß Holger

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige