Korhan Bey,Ben dosyanızı 2500 satırlık olacak şekilde düzenledim.
Sanırım bu haliyle yeterli olacaktır.
İşlem sonunda boş satırlar otomatik gizlenmektedir.
Allah razı olsun. Ellerinize ve aklınıza sağlık.
Tekrar hayırlı bayramlar..
DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Korhan Bey,Ben dosyanızı 2500 satırlık olacak şekilde düzenledim.
Sanırım bu haliyle yeterli olacaktır.
İşlem sonunda boş satırlar otomatik gizlenmektedir.
Korhan Bey,Ben dosyanızı 2500 satırlık olacak şekilde düzenledim.
Sanırım bu haliyle yeterli olacaktır.
İşlem sonunda boş satırlar otomatik gizlenmektedir.
Option Explicit
Sub Mesai_Tablolarini_Iceri_Aktar()
Dim Baglanti As Object, Kayit_Seti As Object
Dim Sorgu As String, Yol As String, Dosya As String
Dim Veri As Range, Alan As Range, Ay As String, Zaman As Double
Zaman = Timer
Application.ScreenUpdating = False
Set Baglanti = CreateObject("Adodb.Connection")
Set Kayit_Seti = CreateObject("Adodb.Recordset")
Range("B7:K2506").ClearContents
Cells.EntireRow.Hidden = False
Ay = Range("K4").Value
Yol = ThisWorkbook.Path & Application.PathSeparator
Dosya = Dir(Yol & "*.xls*")
While Dosya <> ""
If UCase(Replace(Replace(Format(Split(Dosya, " ")(0), "mmmm"), "ı", "I"), "i", "İ")) = Ay Then
Baglanti.Open "Provider=Microsoft.Ace.OleDb.12.0;Data Source=" & _
Yol & Dosya & ";Extended Properties=""Excel 12.0;Hdr=No"""
Sorgu = "Select * From [GÜNLÜK$B7:K]"
Kayit_Seti.Open Sorgu, Baglanti, 1, 1
If Kayit_Seti.RecordCount > 0 Then
Cells(Rows.Count, "B").End(3)(2, 1).CopyFromRecordset Kayit_Seti
End If
If Kayit_Seti.State <> 0 Then Kayit_Seti.Close
If Baglanti.State <> 0 Then Baglanti.Close
End If
Dosya = Dir
Wend
Range("G7:H2506").NumberFormat = "hh:mm:ss"
Set Baglanti = Nothing
Set Kayit_Seti = Nothing
For Each Veri In Range("B7:B2506")
If Veri.Value = "" Then
If Alan Is Nothing Then
Set Alan = Veri
Else
Set Alan = Union(Alan, Veri)
End If
End If
Next
If Not Alan Is Nothing Then Alan.EntireRow.Hidden = True
Application.ScreenUpdating = True
MsgBox "Veri aktarımı tamamlanmıştır." & vbCr & vbCr & _
"İşlem süresi ; " & Format(Timer - Zaman, "0.00") & " Saniye", vbInformation
End Sub
Deneyiniz.
C++:Option Explicit Sub Mesai_Tablolarini_Iceri_Aktar() Dim Baglanti As Object, Kayit_Seti As Object Dim Sorgu As String, Yol As String, Dosya As String Dim Veri As Range, Alan As Range, Ay As String, Zaman As Double Zaman = Timer Application.ScreenUpdating = False Set Baglanti = CreateObject("Adodb.Connection") Set Kayit_Seti = CreateObject("Adodb.Recordset") Range("B7:K2506").ClearContents Cells.EntireRow.Hidden = False Ay = Range("K4").Value Yol = ThisWorkbook.Path & Application.PathSeparator Dosya = Dir(Yol & "*.xls*") While Dosya <> "" If UCase(Replace(Replace(Format(Split(Dosya, " ")(0), "mmmm"), "ı", "I"), "i", "İ")) = Ay Then Baglanti.Open "Provider=Microsoft.Ace.OleDb.12.0;Data Source=" & _ Yol & Dosya & ";Extended Properties=""Excel 12.0;Hdr=No""" Sorgu = "Select * From [GÜNLÜK$B7:K]" Kayit_Seti.Open Sorgu, Baglanti, 1, 1 If Kayit_Seti.RecordCount > 0 Then Cells(Rows.Count, "B").End(3)(2, 1).CopyFromRecordset Kayit_Seti End If If Kayit_Seti.State <> 0 Then Kayit_Seti.Close If Baglanti.State <> 0 Then Baglanti.Close End If Dosya = Dir Wend Range("G7:H2506").NumberFormat = "hh:mm:ss" Set Baglanti = Nothing Set Kayit_Seti = Nothing For Each Veri In Range("B7:B2506") If Veri.Value = "" Then If Alan Is Nothing Then Set Alan = Veri Else Set Alan = Union(Alan, Veri) End If End If Next If Not Alan Is Nothing Then Alan.EntireRow.Hidden = True Application.ScreenUpdating = True MsgBox "Veri aktarımı tamamlanmıştır." & vbCr & vbCr & _ "İşlem süresi ; " & Format(Timer - Zaman, "0.00") & " Saniye", vbInformation End Sub
Sn. Orion1,Bir sütun ya string,ya sayı,yada tarih olmalıdır.
Bir sütunu böyle çorba gibi karıştırıp yaparsanız olmaz.
Exceli veri tabanı olarak kullanırsanız ado kurallarına uymalısınız.
Ayrıca veri tabanı olarak kullanırsanız.ado ile silme yapamazsınız.
Excel için bu geçerli.
Siz en iyisi veri tabanınızı access dosyasından yapınız.
Hocam neredekini kaldırmam gerekiyor?Bu sembol kaynak dosyalarınızda var. Bundan dolayı aktarımla geliyor.
Option Explicit
Sub Mesai_Tablolarini_Iceri_Aktar()
Dim S1 As Worksheet, S2 As Worksheet, Baglanti As Object, Kayit_Seti As Object
Dim Sorgu As String, Yol As String, Dosya As String
Dim Veri As Range, Alan As Range, Ay As String, Zaman As Double
Zaman = Timer
Application.ScreenUpdating = False
Set S1 = Sheets("AYLIK")
Set Baglanti = CreateObject("Adodb.Connection")
Set Kayit_Seti = CreateObject("Adodb.Recordset")
S1.Range("B7:K2506").ClearContents
S1.Cells.EntireRow.Hidden = False
Ay = S1.Range("K4").Value
Yol = ThisWorkbook.Path & Application.PathSeparator
Dosya = Dir(Yol & "*.xls*")
While Dosya <> ""
If UCase(Replace(Replace(Format(Split(Dosya, " ")(0), "mmmm"), "ı", "I"), "i", "İ")) = Ay Then
Baglanti.Open "Provider=Microsoft.Ace.OleDb.12.0;Data Source=" & _
Yol & Dosya & ";Extended Properties=""Excel 12.0;Hdr=No"""
Sorgu = "Select Ucase(F1),Ucase(F2),F3,F4,F5,F6,F7,F8,Ucase(F9),Ucase(F10) From [GÜNLÜK$B7:K]"
Kayit_Seti.Open Sorgu, Baglanti, 1, 1
If Kayit_Seti.RecordCount > 0 Then
S1.Cells(S1.Rows.Count, "B").End(3)(2, 1).CopyFromRecordset Kayit_Seti
End If
If Kayit_Seti.State <> 0 Then Kayit_Seti.Close
If Baglanti.State <> 0 Then Baglanti.Close
End If
Dosya = Dir
Wend
S1.Range("G7:H2506").NumberFormat = "hh:mm:ss"
Set Baglanti = Nothing
Set Kayit_Seti = Nothing
For Each Veri In S1.Range("B7:B2506")
If Veri.Value = "" Then
If Alan Is Nothing Then
Set Alan = Veri
Else
Set Alan = Union(Alan, Veri)
End If
End If
Next
If Not Alan Is Nothing Then Alan.EntireRow.Hidden = True
S1.Range("I7:I2506").Copy
Set S2 = Worksheets.Add
S2.Range("A1").PasteSpecial xlPasteValues
S2.Range("A1:A2500").Copy S1.Range("I7")
Application.DisplayAlerts = False
S2.Delete
Application.DisplayAlerts = True
With S1.Range("I7:I2506")
.Value = .Value
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Borders.LineStyle = 1
End With
Set S1 = Nothing
Set S2 = Nothing
Application.ScreenUpdating = True
MsgBox "Veri aktarımı tamamlanmıştır." & vbCr & vbCr & _
"İşlem süresi ; " & Format(Timer - Zaman, "0.00") & " Saniye", vbInformation
End Sub
Korhan hocam zahmet verdim sizlere hakkınızı helal edin lütfen.Biraz uğraştırdı ama aşağıdaki kod ile o sorunda bende düzeldi görünüyor.
Sizde deneyip sonucu bildirirseniz sevinirim.
C++:Option Explicit Sub Mesai_Tablolarini_Iceri_Aktar() Dim S1 As Worksheet, S2 As Worksheet, Baglanti As Object, Kayit_Seti As Object Dim Sorgu As String, Yol As String, Dosya As String Dim Veri As Range, Alan As Range, Ay As String, Zaman As Double Zaman = Timer Application.ScreenUpdating = False Set S1 = Sheets("AYLIK") Set Baglanti = CreateObject("Adodb.Connection") Set Kayit_Seti = CreateObject("Adodb.Recordset") S1.Range("B7:K2506").ClearContents S1.Cells.EntireRow.Hidden = False Ay = S1.Range("K4").Value Yol = ThisWorkbook.Path & Application.PathSeparator Dosya = Dir(Yol & "*.xls*") While Dosya <> "" If UCase(Replace(Replace(Format(Split(Dosya, " ")(0), "mmmm"), "ı", "I"), "i", "İ")) = Ay Then Baglanti.Open "Provider=Microsoft.Ace.OleDb.12.0;Data Source=" & _ Yol & Dosya & ";Extended Properties=""Excel 12.0;Hdr=No""" Sorgu = "Select * From [GÜNLÜK$B7:K]" Kayit_Seti.Open Sorgu, Baglanti, 1, 1 If Kayit_Seti.RecordCount > 0 Then S1.Cells(S1.Rows.Count, "B").End(3)(2, 1).CopyFromRecordset Kayit_Seti End If If Kayit_Seti.State <> 0 Then Kayit_Seti.Close If Baglanti.State <> 0 Then Baglanti.Close End If Dosya = Dir Wend S1.Range("G7:H2506").NumberFormat = "hh:mm:ss" Set Baglanti = Nothing Set Kayit_Seti = Nothing For Each Veri In S1.Range("B7:B2506") If Veri.Value = "" Then If Alan Is Nothing Then Set Alan = Veri Else Set Alan = Union(Alan, Veri) End If End If Next If Not Alan Is Nothing Then Alan.EntireRow.Hidden = True S1.Range("I7:I2506").Copy Set S2 = Worksheets.Add S2.Range("A1").PasteSpecial xlPasteValues S2.Range("A1:A2500").Copy S1.Range("I7") Application.DisplayAlerts = False S2.Delete Application.DisplayAlerts = True With S1.Range("I7:I2506") .Value = .Value .HorizontalAlignment = xlCenter .Borders.LineStyle = 1 End With Application.ScreenUpdating = True MsgBox "Veri aktarımı tamamlanmıştır." & vbCr & vbCr & _ "İşlem süresi ; " & Format(Timer - Zaman, "0.00") & " Saniye", vbInformation End Sub