DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
[COLOR="Red"]Klasor = ThisWorkbook.Path & "\"[/COLOR]
Sheets("TR").Select
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" [COLOR="red"]& Klasor &[/COLOR] "table.csv", Destination:=Range( _
"$A$1"))
.Name = "table"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 65001
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Böyle bir dene
Kod:[COLOR="Red"]Klasor = ThisWorkbook.Path & "\"[/COLOR] Sheets("TR").Select Range("A1").Select With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;" [COLOR="red"]& Klasor &[/COLOR] "table.csv", Destination:=Range( _ "$A$1")) .Name = "table" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .TextFilePromptOnRefresh = False .TextFilePlatform = 65001 .TextFileStartRow = 1 .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = False .TextFileTabDelimiter = True .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = True .TextFileSpaceDelimiter = False .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1) .TextFileTrailingMinusNumbers = True .Refresh BackgroundQuery:=False End With
Sheets("MAT").Select
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & Klasor & "table (1).csv", Destination:=Range( _
Range("$A$1"))
hocam teşekkürler ilk veri dosyası için işe yaradı fakat "table (1).csv" dosyası için aynı kodu kullandığımda hata veriyor. Sanırım dosya adı içerisinde parantez işareti geçtiği için hata veriyor. çünkü
kodu bu şekilde yaptığımda "("$A$1"))" bu ifadenin sonuna bi parantez daha kapamamı söylüyor(seperater hatası). "("$A$1")))" bu şekilde yaptığımda yine hata verdi.Kod:Sheets("MAT").Select Range("A1").Select With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;" & Klasor & "table (1).csv", Destination:=Range( _ Range("$A$1"))
"table (1).csv"
"table(1).csv"
veri alınacak sayfalarla ilgili sayfa isimleri arasında boşluklar olması
aşağıdaki gibiKod:"table (1).csv"
Kod:"table(1).csv"
hem sayfa isimlerini düzelt hemde kodları bu şekilde düzelt
Buyrun hocam.
Sub verial5()
ReDim sayfalar(6)
ReDim dosyalar(6)
sayfalar(1) = ("TR")
sayfalar(2) = ("MAT")
sayfalar(3) = ("DİN")
sayfalar(4) = ("FEN")
sayfalar(5) = ("SOS")
sayfalar(6) = ("İNG")
dosyalar(1) = "table"
dosyalar(2) = "table (1)"
dosyalar(3) = "table (2)"
dosyalar(4) = "table (3)"
dosyalar(5) = "table (4)"
dosyalar(6) = "table (5)"
Klasor = ThisWorkbook.Path & "\"
For j = 1 To 6
Dosya = Klasor & dosyalar(j) & ".csv"
sat = 1
Open Dosya For Input As #1
Do While Not EOF(1)
Line Input #1, deg1
deg1 = Split(Trim(deg1), ",""")
If UBound(deg1) > 0 Then
For i = LBound(deg1) To UBound(deg1)
Sheets(sayfalar(j)).Cells(sat, i + 1) = Replace(deg1(i), """", "")
Next
sat = sat + 1
End If
Loop
Close #1
Next j
MsgBox "işlem tamam", vbOKOnly + vbInformation, "uyarı"
End Sub
Sub verial2()
Klasor = ThisWorkbook.Path & "\"
son = 6
ReDim sayfalar(son)
ReDim dosyalar(son)
sayfalar(1) = ("TR")
sayfalar(2) = ("MAT")
sayfalar(3) = ("DİN")
sayfalar(4) = ("FEN")
sayfalar(5) = ("SOS")
sayfalar(6) = ("İNG")
dosyalar(1) = "table"
dosyalar(2) = "table (1)"
dosyalar(3) = "table (2)"
dosyalar(4) = "table (3)"
dosyalar(5) = "table (4)"
dosyalar(6) = "table (5)"
For k = 1 To son
If CreateObject("Scripting.FileSystemObject").FileExists(Klasor & dosyalar(k) & ".csv") = True Then
Sheets(sayfalar(k)).Range("A1:I500").ClearContents
With Sheets(sayfalar(k)).QueryTables.Add(Connection:= _
"TEXT;" & Klasor & dosyalar(k) & ".csv", Destination:=Sheets(sayfalar(k)).Range( _
"$A$1"))
.Name = dosyalar(k)
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 65001
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End If
Next k
Dim qt As QueryTable
For Each qt In ActiveSheet.QueryTables
qt.Delete
Next qt
MsgBox "işlem tamam"
End Sub
Bu kod da farklı
Kod:Sub verial2() Klasor = ThisWorkbook.Path & "\" son = 6 ReDim sayfalar(son) ReDim dosyalar(son) sayfalar(1) = ("TR") sayfalar(2) = ("MAT") sayfalar(3) = ("DİN") sayfalar(4) = ("FEN") sayfalar(5) = ("SOS") sayfalar(6) = ("İNG") dosyalar(1) = "table" dosyalar(2) = "table (1)" dosyalar(3) = "table (2)" dosyalar(4) = "table (3)" dosyalar(5) = "table (4)" dosyalar(6) = "table (5)" For k = 1 To son If CreateObject("Scripting.FileSystemObject").FileExists(Klasor & dosyalar(k) & ".csv") = True Then Sheets(sayfalar(k)).Range("A1:I500").ClearContents With Sheets(sayfalar(k)).QueryTables.Add(Connection:= _ "TEXT;" & Klasor & dosyalar(k) & ".csv", Destination:=Sheets(sayfalar(k)).Range( _ "$A$1")) .Name = dosyalar(k) .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .TextFilePromptOnRefresh = False .TextFilePlatform = 65001 .TextFileStartRow = 1 .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = False .TextFileTabDelimiter = True .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = True .TextFileSpaceDelimiter = False .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1) .TextFileTrailingMinusNumbers = True .Refresh BackgroundQuery:=False End With End If Next k Dim qt As QueryTable For Each qt In ActiveSheet.QueryTables qt.Delete Next qt MsgBox "işlem tamam" End Sub