• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Filtre Kaldırma Makrosu

  • Konbuyu başlatan Konbuyu başlatan clodj
  • Başlangıç tarihi Başlangıç tarihi
Katılım
30 Temmuz 2008
Mesajlar
64
Excel Vers. ve Dili
Excell 2007 İngilizce
Merhaba,
Aşağıdaki kodu kullandığım makroda S2 olarak tanımlanan Veri Kayıt Sayfasında (veri>fitre uygula>otomatik filtre uygula)
Filtreleme var ise filtrelemeyi kaldırdıktan sonra işleme başlamasını istiyorum. Filtreleme yoksa zaten sorun yok işleme devam etsin.
Bunu nasıl ekleyebilirim?



Kod:
Sub Renk_Baskı_Butonu()
         
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("V2").Select
    Application.CutCopyMode = False
    
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    
    Dim Son_Satır As Long, S1 As Worksheet, S2 As Worksheet
    
    Set S1 = Sheets("Tablo")
    Set S2 = Sheets("Veri Kayıt")
    Son_Satır = S2.[A65536].End(3).Row + 1
    
        
    If S1.Range("E2") = "İlk Parti" Then
        MsgBox "LÜTFEN GÜNCEL PARTİ NUMARASININ DOĞRU OLDUĞUNU KONTROL EDİNİZ !", vbCritical, "Dikkat !"
    End If
    
    
    
    S2.Cells(Son_Satır, 2) = S1.Range("B4").Value
    S2.Cells(Son_Satır, 3) = S1.Range("B5").Value
    S2.Cells(Son_Satır, 4) = S1.Range("B6").Value
    S2.Cells(Son_Satır, 5) = S1.Range("B2").Value
    If S1.Range("A10") = "Brüt Kg" Then
    S2.Cells(Son_Satır, 8) = S1.Range("B11").Value
    ElseIf S1.Range("A10") = "Net Kg" Then
    S2.Cells(Son_Satır, 8) = S1.Range("B10").Value
    End If
    S2.Cells(Son_Satır, 7) = S1.Range("B3").Value
    S2.Cells(Son_Satır, 6) = S1.Range("B1").Value
    
    S2.Cells(Son_Satır, 1) = S2.Cells(Son_Satır, 2) & "-" & S2.Cells(Son_Satır, 3)
    S2.Cells(Son_Satır, 9) = S1.Range("B7").Value
    S2.Cells(Son_Satır, 10) = S1.Range("B8").Value
    S2.Cells(Son_Satır, 11) = S1.Range("B9").Value
    S2.Cells(Son_Satır, 12) = S1.Range("B12").Value
    S2.Cells(Son_Satır, 13) = S1.Range("B13").Value
    S2.Cells(Son_Satır, 14) = S1.Range("B14").Value
    S2.Cells(Son_Satır, 15) = S1.Range("B15").Value
    S2.Cells(Son_Satır, 16) = S1.Range("E9").Value
    S2.Cells(Son_Satır, 17) = S1.Range("E8").Value
    S2.Cells(Son_Satır, 18) = S1.Range("B17").Value
    S2.Cells(Son_Satır, 19) = S1.Range("A1").Value
    S2.Cells(Son_Satır, 20) = S1.Range("F3").Value
    S2.Cells(Son_Satır, 21) = S1.Range("E3").Value
    S2.Cells(Son_Satır, 22) = S2.Cells(Son_Satır, 2) & "-" & S2.Cells(Son_Satır, 4) & "-" & S2.Cells(Son_Satır, 3) & "-" & S2.Cells(Son_Satır, 6)
    S2.Cells(Son_Satır, 23) = S1.Range("B18").Value
    S2.Cells(Son_Satır, 24) = S1.Range("B16").Value
    S2.Cells(Son_Satır, 25) = S1.Range("C16").Value
    S2.Cells(Son_Satır, 27) = S1.Range("E30").Value
    
    S2.Cells(Son_Satır, 29) = S1.Range("E31").Value
    S2.Cells(Son_Satır, 30) = S1.Range("B32").Value
    S2.Cells(Son_Satır, 31) = S1.Range("A32").Value
    S2.Cells(Son_Satır, 32) = S1.Range("B33").Value
    S2.Cells(Son_Satır, 33) = S1.Range("A33").Value
    S2.Cells(Son_Satır, 34) = S1.Range("B34").Value
    S2.Cells(Son_Satır, 35) = S1.Range("A34").Value
    S2.Cells(Son_Satır, 36) = S1.Range("B35").Value
    S2.Cells(Son_Satır, 37) = S1.Range("A35").Value
    S2.Cells(Son_Satır, 40) = S1.Range("B25").Value
    S2.Cells(Son_Satır, 41) = S1.Range("A25").Value
    S2.Cells(Son_Satır, 42) = S1.Range("B26").Value
    S2.Cells(Son_Satır, 43) = S1.Range("A26").Value
    S2.Cells(Son_Satır, 44) = S1.Range("B27").Value
    S2.Cells(Son_Satır, 45) = S1.Range("A27").Value
    S2.Cells(Son_Satır, 46) = S1.Range("B28").Value
    S2.Cells(Son_Satır, 47) = S1.Range("A28").Value
    S2.Cells(Son_Satır, 48) = S1.Range("B29").Value
    S2.Cells(Son_Satır, 49) = S1.Range("A29").Value
    S2.Cells(Son_Satır, 52) = S1.Range("D37").Value
    S2.Cells(Son_Satır, 53) = S1.Range("B38").Value
    S2.Cells(Son_Satır, 54) = S1.Range("A38").Value
    S2.Cells(Son_Satır, 55) = S1.Range("B39").Value
    S2.Cells(Son_Satır, 56) = S1.Range("A39").Value
    S2.Cells(Son_Satır, 57) = S1.Range("B40").Value
    S2.Cells(Son_Satır, 58) = S1.Range("A40").Value
    S2.Cells(Son_Satır, 59) = S1.Range("B41").Value
    S2.Cells(Son_Satır, 60) = S1.Range("A41").Value
    S2.Cells(Son_Satır, 61) = S1.Range("B42").Value
    S2.Cells(Son_Satır, 62) = S1.Range("A42").Value
    S2.Cells(Son_Satır, 63) = S1.Range("B43").Value
    S2.Cells(Son_Satır, 64) = S1.Range("A43").Value
    S2.Cells(Son_Satır, 65) = S1.Range("B44").Value
    S2.Cells(Son_Satır, 66) = S1.Range("A44").Value
    
    S2.Cells(Son_Satır, 69) = S1.Range("E48").Value
    S2.Cells(Son_Satır, 70) = S1.Range("E47").Value
    
    S2.Cells(Son_Satır, 71) = S1.Range("B48").Value
    S2.Cells(Son_Satır, 72) = S1.Range("A48").Value
    S2.Cells(Son_Satır, 73) = S1.Range("B49").Value
    S2.Cells(Son_Satır, 74) = S1.Range("A49").Value
    S2.Cells(Son_Satır, 75) = S1.Range("B50").Value
    S2.Cells(Son_Satır, 76) = S1.Range("A50").Value
    S2.Cells(Son_Satır, 77) = S1.Range("B51").Value
    S2.Cells(Son_Satır, 78) = S1.Range("A51").Value
    
    S2.Cells(Son_Satır, 81) = S1.Range("B54").Value
    S2.Cells(Son_Satır, 82) = S1.Range("A54").Value
    S2.Cells(Son_Satır, 83) = S1.Range("B55").Value
    S2.Cells(Son_Satır, 84) = S1.Range("A55").Value
    S2.Cells(Son_Satır, 85) = S1.Range("B56").Value
    S2.Cells(Son_Satır, 86) = S1.Range("A56").Value
    S2.Cells(Son_Satır, 87) = S1.Range("B57").Value
    S2.Cells(Son_Satır, 88) = S1.Range("A57").Value
       
    S2.Cells(Son_Satır, 94) = S1.Range("A60").Value
    S2.Cells(Son_Satır, 95) = S1.Range("B61").Value
    S2.Cells(Son_Satır, 96) = S1.Range("A61").Value
    S2.Cells(Son_Satır, 97) = S1.Range("B62").Value
    S2.Cells(Son_Satır, 98) = S1.Range("A62").Value
    S2.Cells(Son_Satır, 99) = S1.Range("B63").Value
    S2.Cells(Son_Satır, 100) = S1.Range("A63").Value
    S2.Cells(Son_Satır, 101) = S1.Range("B64").Value
    S2.Cells(Son_Satır, 102) = S1.Range("A64").Value
    
    S2.Cells(Son_Satır, 105) = S1.Range("B74").Value
    S2.Cells(Son_Satır, 106) = S1.Range("A74").Value
    S2.Cells(Son_Satır, 107) = S1.Range("B75").Value
    S2.Cells(Son_Satır, 108) = S1.Range("A75").Value
    S2.Cells(Son_Satır, 109) = S1.Range("B76").Value
    S2.Cells(Son_Satır, 110) = S1.Range("A76").Value
    S2.Cells(Son_Satır, 111) = S1.Range("B77").Value
    S2.Cells(Son_Satır, 112) = S1.Range("A77").Value
    S2.Cells(Son_Satır, 113) = S1.Range("D73").Value
    S2.Cells(Son_Satır, 114) = S1.Range("E73").Value
    
    S2.Cells(Son_Satır, 116) = S1.Range("B80").Value
    S2.Cells(Son_Satır, 117) = S1.Range("A80").Value
    S2.Cells(Son_Satır, 118) = S1.Range("B81").Value
    S2.Cells(Son_Satır, 119) = S1.Range("A81").Value
    S2.Cells(Son_Satır, 120) = S1.Range("B82").Value
    S2.Cells(Son_Satır, 121) = S1.Range("A82").Value
    S2.Cells(Son_Satır, 122) = S1.Range("B83").Value
    S2.Cells(Son_Satır, 123) = S1.Range("A83").Value
    S2.Cells(Son_Satır, 124) = S1.Range("D79").Value
    S2.Cells(Son_Satır, 125) = S1.Range("E79").Value

    S2.Cells(Son_Satır, 126) = S1.Range("B86").Value
    S2.Cells(Son_Satır, 127) = S1.Range("A86").Value
    S2.Cells(Son_Satır, 128) = S1.Range("B87").Value
    S2.Cells(Son_Satır, 129) = S1.Range("A87").Value
    S2.Cells(Son_Satır, 130) = S1.Range("B88").Value
    S2.Cells(Son_Satır, 131) = S1.Range("A88").Value
    S2.Cells(Son_Satır, 132) = S1.Range("B89").Value
    S2.Cells(Son_Satır, 133) = S1.Range("A89").Value
    S2.Cells(Son_Satır, 134) = S1.Range("D85").Value
    S2.Cells(Son_Satır, 135) = S1.Range("E85").Value
   
    S2.Cells(Son_Satır, 136) = S1.Range("B92").Value
    S2.Cells(Son_Satır, 137) = S1.Range("A92").Value
    S2.Cells(Son_Satır, 138) = S1.Range("B93").Value
    S2.Cells(Son_Satır, 139) = S1.Range("A93").Value
    S2.Cells(Son_Satır, 140) = S1.Range("B94").Value
    S2.Cells(Son_Satır, 141) = S1.Range("A94").Value
    S2.Cells(Son_Satır, 142) = S1.Range("B95").Value
    S2.Cells(Son_Satır, 143) = S1.Range("A95").Value
    S2.Cells(Son_Satır, 144) = S1.Range("D91").Value
    S2.Cells(Son_Satır, 145) = S1.Range("E91").Value
    
    S2.Cells.EntireColumn.AutoFit
      
    
    Set S1 = Nothing
    Set S2 = Nothing
    
    

    Application.ScreenUpdating = True
    Application.Calculation = xlCalculationAutomatic

End Sub
 
Merhaba,

Kodların başına;

Kod:
On Error Resume Next
Kodların sonuna;

Kod:
ActiveSheet.ShowAllData
ekleyiniz.
 
Ekledim fakat aynısorun devam ediyor fitreleme yapılı haldeyken makroyu çalıştırdığımda daha önceki verilerin üzerine rastgele kayıt yapıyor. Eğer filtrelemeyi kaldırabilirsem o zaman veri kayıt işlemine en aşağıdaki boş satırdan devam ediyor.
Tam bilmeyerek "eğer S2 sayfasında fitreleme var ise kaldır" şeklinde kod girmek gerekiyor sanırım.
 
Selamlar,

Makronuzun Son_Satır = S2.[A65536].End(3).Row + 1 ifadesinden sonraki bölümüne aşağıdaki kodu ekleyin.

Kod:
If S2.AutoFilterMode = True Then S2.ShowAllData
 
Korhan Bey ve Ömer Bey çok teşekkürler.
başlangıça
Kod:
On Error Resume Next

ekledim
Sonrada aşağıdaki gibi ekledim

Kod:
If S2.AutoFilterMode = True Then S2.ShowAllData
Son_Satır = S2.[A65536].End(3).Row + 1


sorun çözüldü.
 
Geri
Üst