Bonjour,
je cherche à importer plusieurs fichiers csv dans une feuille excel mais je me retrouve avec un probleme de taille : les nouvelles importations me decalent celles d'avant et j'ai une ligne identique
voici le code que j'utilise.
If Feuille <> "" Then
Set Origine = Sheets("Import-" & Feuille)
Origine.Activate
toto = Origine.UsedRange.Rows.Count
'Range("A1").Select
'Range("A" & toto + 1).Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & objFile.Path, _
Destination:=Range("A" & toto + 1))
.Name = objFile.Name
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 1252
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
'.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End If
Merci pour votre aide
je cherche à importer plusieurs fichiers csv dans une feuille excel mais je me retrouve avec un probleme de taille : les nouvelles importations me decalent celles d'avant et j'ai une ligne identique
voici le code que j'utilise.
If Feuille <> "" Then
Set Origine = Sheets("Import-" & Feuille)
Origine.Activate
toto = Origine.UsedRange.Rows.Count
'Range("A1").Select
'Range("A" & toto + 1).Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & objFile.Path, _
Destination:=Range("A" & toto + 1))
.Name = objFile.Name
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 1252
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
'.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End If
Merci pour votre aide