- Katılım
- 24 Temmuz 2019
- Mesajlar
- 484
- Excel Vers. ve Dili
- EXCEL 2010 TÜRKÇE
DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Çok özür dilerim @ÖmerFaruk Bey yanlış dosya yüklemişim. Dosya evdeki bilgisayarda akşam tekrar yükleyeceğim artık. Tekrar tekrar tekrar özür dilerim. Kusura bakmayın ne olur sabahın etkisiSayın Feylosof,
Dosyanızda Liste sayfası yok, Yoklama sayfası yok, Sarı Renkli hücre yok.
Sub ListeleriDoldur()
Dim Bul As Range, BulAdres As String, TimerStart As Double, SonSat As Long, xSon As Integer
TimerStart = Timer
SonSat = Worksheets("Yoklama").Range("A" & Rows.Count).End(3).Row
Set Bul = Worksheets("Yoklama").Range("A2:A" & SonSat).Find("SIRA", , , xlWhole)
If Bul Is Nothing Then Exit Sub
BulAdres = Bul.Address
Do
xSon = Worksheets("Yoklama").Range("A" & Bul.Row).End(xlDown).Row - 1
Worksheets("Yoklama").Range("B" & Bul.Row + 2, "C" & xSon).ClearContents
Call ADO_Liste(Range("A" & Bul.Row - 2).Value, Bul.Row + 2)
Set Bul = Worksheets("Yoklama").Range("A2:A" & SonSat).FindNext(Bul)
Loop While Bul.Address <> BulAdres
MsgBox "Veri aktarımı tamamlanmıştır." & Chr(10) & Chr(10) & "İşlem süresi ; " & Format(Timer - TimerStart, "0.00") & " Saniye", vbInformation
End Sub
Sub ADO_Liste(xSınıf As String, xFirstRow As Long)
Dim ifade As String, MyCn As Object, MyRs As Object
Set MyCn = CreateObject("ADODB.Connection")
Set MyRs = CreateObject("adodb.recordset")
MyCn.Provider = "Microsoft.ACE.OLEDB.12.0"
MyCn.Properties("Data Source") = ThisWorkbook.FullName
MyCn.Properties("Extended Properties") = "Excel 12.0; HDR=Yes"
MyCn.Open
ifade = "Select Top 50 [No], [Adı Soyadı] from [Liste$] Where [Sınıf]= '" & xSınıf & "' Order By [No]"
MyRs.Open ifade, MyCn, 1, 1
If MyRs.RecordCount > 0 Then
Sheets("Yoklama").Range("B" & xFirstRow).CopyFromRecordset MyRs
End If
MyRs.Close
MyCn.Close
Set MyCn = Nothing: Set MyRs = Nothing: ifade = ""
End Sub