Thema Datum  Von Nutzer Rating
Antwort
15.02.2020 11:15:07 Julian
NotSolved
15.02.2020 12:02:18 Mase
NotSolved
15.02.2020 13:14:58 Julian
NotSolved
15.02.2020 13:18:22 Mase
NotSolved
15.02.2020 14:00:49 Julian
NotSolved
15.02.2020 15:01:46 Gast45851
NotSolved
15.02.2020 15:36:16 Gast173
NotSolved
15.02.2020 15:47:24 Julian
NotSolved
15.02.2020 16:27:48 Mase
NotSolved
15.02.2020 17:11:01 Gast18449
NotSolved
15.02.2020 17:27:38 Mase
NotSolved
15.02.2020 18:58:58 Gast85399
NotSolved
15.02.2020 19:16:16 Mase
NotSolved
15.02.2020 19:22:08 Gast78988
NotSolved
15.02.2020 19:05:16 Julian
NotSolved
15.02.2020 19:23:39 Gast65371
NotSolved
16.02.2020 09:22:09 Julian
NotSolved
17.02.2020 08:23:02 Mase
NotSolved
22.02.2020 19:24:07 Julian
NotSolved
Blau For...Next Schleifen wird nicht hochgezählt
22.02.2020 23:20:55 Mase
NotSolved
03.03.2020 18:45:05 Julian
NotSolved
03.03.2020 20:08:49 Mase
NotSolved

Ansicht des Beitrags:
Von:
Mase
Datum:
22.02.2020 23:20:55
Views:
723
Rating: Antwort:
  Ja
Thema:
For...Next Schleifen wird nicht hochgezählt

Nabend julian,

versuch mal folgendes nd sage mir, ob das hinkommt.

Bemerkung vorab:

Es wird zwar kopiert, aber noch nicht in Deiner gewünschten Reihenfolge - 

Ausserdem bin Ich bei einigen Dingen Deiner Programmlogik treugeblieben, sodass Du Dich recht schnell zurechtfinden solltest.

 

Sag Bescheid, wenn die Richtung stimmt - 

 

Option Explicit

Sub selbstcopy30()
    Dim wksDatenbank As Excel.Worksheet
    Dim wksEinstellungen As Excel.Worksheet
    Dim wksEingabe As Excel.Worksheet
    Dim wksTeile As Excel.Worksheet
    Dim rng As Excel.Range

    Dim u As Long, i As Long
    Dim numr As Variant, artikelnr As Variant, hoehe As Variant, Besch As Variant, besch2 As Variant, zartikelnr As Variant, zhoehe As Variant, anzahl As Variant, breite As Variant, laenge As Variant
    '
    Set wksEinstellungen = ThisWorkbook.Worksheets("Einstellungen")
    With wksEinstellungen
        artikelnr = .Range("B15").Value
        hoehe = .Range("B16").Value
    End With
    '
    Set wksDatenbank = ThisWorkbook.Worksheets("Datenbank")
    With wksDatenbank
        Besch = .Range("A1").Value
        besch2 = .Range("A2").Value
        breite = .Range("A3").Value
        laenge = .Range("A5").Value
        anzahl = .Range("A8").Value
        zartikelnr = .Range("A6").Value
        zhoehe = .Range("A4").Value
    End With
    '
    'Sheets("Eingabe").Select
    Set wksEingabe = ThisWorkbook.Worksheets("Eingabe")
    Set wksTeile = ThisWorkbook.Worksheets("Teile")
'    For i = 3 To 15
'        For u = 2 To 16
'            If wksEingabe.Cells(i, zartikelnr) = artikelnr Then
'                If wksEingabe.Cells(i, zhoehe) = hoehe Then
'                'länge
'                wksEingabe.Cells(i, laenge).Copy Destination:=wksTeile.Cells(u, 1)
'                'breite
'                wksEingabe.Cells(i, breite).Copy Destination:=wksTeile.Cells(u, 2)
'                '  ActiveSheet.Paste
'                wksEingabe.Cells(i, anzahl).Copy Destination:=wksTeile.Cells(u, 3)
'                'ActiveSheet.Paste
'                'beschreibung
'                wksEingabe.Cells(i, Besch).Copy Destination:=wksTeile.Cells(u, 9)
'                End If
'            End If
'        Next u
'    Next i
    'Sheets("Teile").Select
    With wksEingabe
        
        If .AutoFilterMode Then .AutoFilterMode = False
        
        Set rng = .Range("A2:J" & .Cells(.Rows.Count, 10).End(xlUp).Row)
        If rng.Rows.Count <= 1 Then MsgBox "Keine Daten vorhanden!": Exit Sub
        
            rng.AutoFilter Field:=3, Criteria1:=artikelnr
                rng.AutoFilter Field:=10, Criteria1:=hoehe
                
                If Not Intersect(rng, rng.Offset(1, 0), rng.SpecialCells(xlCellTypeVisible)) Is Nothing Then
                    Call Intersect(rng, rng.Offset(1, 0), rng.SpecialCells(xlCellTypeVisible)).Copy
                    With wksTeile
                        .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteAll
                        Application.CutCopyMode = False
                    End With
                End If
        
        'ShowAllData
        .AutoFilterMode = False
    End With
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
15.02.2020 11:15:07 Julian
NotSolved
15.02.2020 12:02:18 Mase
NotSolved
15.02.2020 13:14:58 Julian
NotSolved
15.02.2020 13:18:22 Mase
NotSolved
15.02.2020 14:00:49 Julian
NotSolved
15.02.2020 15:01:46 Gast45851
NotSolved
15.02.2020 15:36:16 Gast173
NotSolved
15.02.2020 15:47:24 Julian
NotSolved
15.02.2020 16:27:48 Mase
NotSolved
15.02.2020 17:11:01 Gast18449
NotSolved
15.02.2020 17:27:38 Mase
NotSolved
15.02.2020 18:58:58 Gast85399
NotSolved
15.02.2020 19:16:16 Mase
NotSolved
15.02.2020 19:22:08 Gast78988
NotSolved
15.02.2020 19:05:16 Julian
NotSolved
15.02.2020 19:23:39 Gast65371
NotSolved
16.02.2020 09:22:09 Julian
NotSolved
17.02.2020 08:23:02 Mase
NotSolved
22.02.2020 19:24:07 Julian
NotSolved
Blau For...Next Schleifen wird nicht hochgezählt
22.02.2020 23:20:55 Mase
NotSolved
03.03.2020 18:45:05 Julian
NotSolved
03.03.2020 20:08:49 Mase
NotSolved