bonjour,
J'ai un USF où l'on choisit son fichier CSV.
J'arrive à l'importer mais il ne le convertit pas.
Cependant si j'ouvre le CSV directement en excel, il s'affiche correctement.
Une aide svp. Merci
Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 Private Sub CBImportCsv_Click() Application.ScreenUpdating = False Dim Chemin As String, Fichier As String Dim Wb As Workbook 'Définit le répertoire contenant les fichiers Chemin = ThisWorkbook.Path & Application.PathSeparator Folder = "VEK_12xxxx1112xx\" 'Boucle sur tous les fichiers xls du répertoire. Fichier = Dir(Chemin & Folder & ListBox1.Value) Do While Fichier <> "" 'Désactive l'évènement Application.EnableEvents = False ' ouvre fichier trouvé Set Wb = Workbooks.Open(Chemin & folder & Fichier) ' copy/paste les données Range("A2:O" & ActiveSheet.UsedRange.Rows.Count).Copy ThisWorkbook.Sheets("VISA_VEK").Range("B1048576").End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues, Operation _ :=xlNone, SkipBlanks:=False, Transpose:=False Call ClearClipboard ' ferme le fichier trouvé en cours Wb.Close True Set Wb = Nothing Fichier = Dir Loop MsgBox "Données exportées" 'Réactive l'évènement Application.EnableEvents = True Application.ScreenUpdating = True End Sub
Partager