- Katılım
- 24 Nisan 2008
- Mesajlar
- 24
- Excel Vers. ve Dili
- pro_plus_2024 tr
DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Option Explicit
Sub Aktar()
Dim My_Connection As Object, My_Recordset As Object, My_Query As String
Application.ScreenUpdating = False
Set My_Connection = CreateObject("AdoDB.Connection")
Set My_Recordset = CreateObject("ADODB.Recordset")
Range("A2:B" & Rows.Count).ClearContents
Range("F2:F" & Rows.Count).ClearContents
Range("J2:K" & Rows.Count).ClearContents
Range("S2:S" & Rows.Count).ClearContents
My_Connection.Open "Provider=Microsoft.Ace.OleDb.12.0;Data Source=" & _
ThisWorkbook.Path & "\liste.xlsx" & ";Extended Properties=""Excel 12.0;Hdr=No;Imex=1"""
My_Query = "Select F2,F1 From [Sayfa1$A2:F] Where F1 Is Not Null"
My_Recordset.Open My_Query, My_Connection, 1, 1
Range("A2").CopyFromRecordset My_Recordset
My_Recordset.Close
My_Query = "Select F4 From [Sayfa1$A2:F] Where F1 Is Not Null"
My_Recordset.Open My_Query, My_Connection, 1, 1
Range("F2").CopyFromRecordset My_Recordset
My_Recordset.Close
My_Query = "Select F3,F5 From [Sayfa1$A2:F] Where F1 Is Not Null"
My_Recordset.Open My_Query, My_Connection, 1, 1
Range("J2").CopyFromRecordset My_Recordset
My_Recordset.Close
My_Query = "Select F6 From [Sayfa1$A2:F] Where F1 Is Not Null"
My_Recordset.Open My_Query, My_Connection, 1, 1
Range("S2").CopyFromRecordset My_Recordset
My_Recordset.Close
Columns.AutoFit
My_Connection.Close
Set My_Recordset = Nothing
Set My_Connection = Nothing
Application.ScreenUpdating = True
MsgBox "İşleminiz tamamlanmıştır"
End Sub
Option Explicit
Sub Aktar()
Dim My_Connection As Object, My_Recordset As Object, My_Query As String
Application.ScreenUpdating = False
Set My_Connection = CreateObject("AdoDB.Connection")
Set My_Recordset = CreateObject("ADODB.Recordset")
Range("A2:B" & Rows.Count).ClearContents
Range("F2:F" & Rows.Count).ClearContents
Range("J2:K" & Rows.Count).ClearContents
Range("S2:S" & Rows.Count).ClearContents
My_Connection.Open "Provider=Microsoft.Ace.OleDb.12.0;Data Source=" & _
ThisWorkbook.Path & "\liste.xlsx" & ";Extended Properties=""Excel 12.0;Hdr=Yes;Imex=1"""
My_Query = "Select [Kod],[Adı] From [Sayfa1$] Where [Kod] Is Not Null"
My_Recordset.Open My_Query, My_Connection, 1, 1
Range("A2").CopyFromRecordset My_Recordset
My_Recordset.Close
My_Query = "Select [KDV_ oranı] From [Sayfa1$] Where [Kod] Is Not Null"
My_Recordset.Open My_Query, My_Connection, 1, 1
Range("F2").CopyFromRecordset My_Recordset
My_Recordset.Close
My_Query = "Select [Birim],[Barkod] From [Sayfa1$] Where [Kod] Is Not Null"
My_Recordset.Open My_Query, My_Connection, 1, 1
Range("J2").CopyFromRecordset My_Recordset
My_Recordset.Close
My_Query = "Select [Fiyatı] From [Sayfa1$] Where [Kod] Is Not Null"
My_Recordset.Open My_Query, My_Connection, 1, 1
Range("S2").CopyFromRecordset My_Recordset
My_Recordset.Close
Columns.AutoFit
My_Connection.Close
Set My_Recordset = Nothing
Set My_Connection = Nothing
MsgBox "İşleminiz tamamlanmıştır"
End Sub