Skip to main content

AccessTr.neT


Klasör İçerisindeki 3 Yardımcı Kitaptan Ana Kitaba Veri Aktarımı

Klasör İçerisindeki 3 Yardımcı Kitaptan Ana Kitaba Veri Aktarımı

#26
Son dosyanıza göre alttaki kod çalışıyor.Tabii kalasördeki gibi isimlerle başlaması gerek.

Sub GetData()

Dim sFile As Workbook, syfparca As Worksheet
Dim dosya As String, kes, parcaAl
Dim s1 As Worksheet, s2 As Worksheet, s3 As Worksheet

Const syfizin As String = "Ýzin"
Const syfRapor As String = "Rapor"
Const syfucretsiz As String = "Ücretsiz"

Dim syf As Worksheet

    For Each syf In ThisWorkbook.Worksheets
        If syf.Name Like syfizin Then
            Set s1 = syf: s1.Cells.Clear
        ElseIf syf.Name Like syfRapor Then
            Set s2 = syf: s2.Cells.Clear
        ElseIf syf.Name Like syfucretsiz Then
            Set s3 = syf: s3.Cells.Clear
        End If
    Next

Application.ScreenUpdating = False
    dosya = Dir(ThisWorkbook.Path & Application.PathSeparator & "*.xls*")
        Do While dosya <> ""
            If dosya <> ThisWorkbook.Name Then
                Set sFile = Workbooks.Open(ThisWorkbook.Path & Application.PathSeparator & dosya)
                kes = Split(dosya, ".")
                parcaAl = Mid(dosya, 1, Len(dosya) - Len(kes(UBound(kes))) - 1)
                Set syfparca = Workbooks(parcaAl).Sheets("Sayfa1")
             
                If parcaAl Like "*Senelik " & syfizin & "*" Then
                  syfparca.Range("A1").CurrentRegion.Copy s1.Cells(1, 1)
                ElseIf parcaAl Like "*Dr." & syfRapor & "*" Then
                    syfparca.Range("A1").CurrentRegion.Copy s2.Cells(1, 1)
                ElseIf parcaAl Like "*" & syfucretsiz & " Ýzin*" Then
                    syfparca.Range("A1").CurrentRegion.Copy s3.Cells(1, 1)
                End If
                kes = "": sFile.Close
            End If
            Application.CutCopyMode = False
            dosya = Dir
        Loop
    Application.ScreenUpdating = True
    s1.Activate
    s1.Cells(1, 1).Activate
    MsgBox "Bitti"
    Set sFile = Nothing: parcaAl = vbNullString
    Set s1 = Nothing: Set s2 = Nothing: Set s3 = Nothing: Set syf = Nothing
End Sub

(08/05/2021, 22:40)yyhy yazdı: İzin ibarelerini kaldırayım Dr.Raporu, Senelik, Ücretsiz olarak düzelteyim/düzeltip o şekilde uyarlayabilir misiniz?
Bence daha garanti olur abey.
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
RE: Klasör İçerisindeki 3 Yardımcı Kitaptan Ana Kitaba Veri Aktarımı - Yazar: feraz - 08/05/2021, 22:49