Dim strTemp As String Dim MyDataObject As DataObject Open NomDuFichier For Binary As #1 strTemp = Space$(LOF(1)) Get #1, , strTemp Set MyDataObject = New DataObject MyDataObject.SetText strTemp nbLignes = Cells(Rows.Count, "A").End(xlUp).Row + 1 MyDataObject.PutInClipboard Range("A" & nbLignes).PasteSpecial Close #1 MyDataObject.Clear Set MyDataObject = Nothing
For Each c In Columns("A1:A" & Rows.Count).SpecialCells(xlCellTypeConstants) c.Value = c.Text Next
For Each c In Columns("A2:A" & Rows.Count).SpecialCells(xlCellTypeConstants), ce la me renvoit une erreur d'exécution 1004: erreur défini par l'objet ou par l'application.
For Each c In Range("A2:A" & Rows.Count).SpecialCells(xlCellTypeConstants)et la ça fonctionne !
Il n'y a pas un moyen de le traiter avec un tableau(array)?
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionucfoutu, pourrais tu me donner plus de précision quant au Cdate sur les strings
Dim toto As Range, tablo, derlig As Long derlig = Range("A" & Rows.Count).End(xlUp).Row Set toto = Range("A2:A" & derlig) tablo = toto toto.NumberFormat = "dd/mm/yyyy" For i = 1 To UBound(tablo) tablo(i, 1) = CDate(tablo(i, 1)) Next toto = tablo
Dim derligne1 As Long Dim derligne2 As Long, derligne3 As Long, derligne4 As Long, derligne5 As Long, derligne6 As Byte Dim tablo1 As Variant, tablo2 As Variant, tablo3 As Variant Dim ecart_date As Integer Dim I As Long, k As Long, u As Byte, f As Long Dim Tablo() As Variant, CelSource As Variant Dim Cel As Range Dim ladate1 As Date, ladate2 As Date Dim Source Dim Temp As String Dim TabloOK As Boolean Dim fs Dim toto As Range, tableau 'Importer les données de plusieurs classeurs Application.ScreenUpdating = False Set fs = CreateObject("Scripting.FileSystemObject") TabloOK = False derligne2 = Sheets("releve_erreur").Range("A" & Rows.Count).End(xlUp)(2).Row 'definit la derniere ligne de la colonne A ladate1 = DTPicker1.Value ladate2 = DTPicker2.Value Temp = Dir(ActiveWorkbook.Path & "\*.csv") Do While Temp <> "" Workbooks.Open Filename:=ThisWorkbook.Path & "" & Temp With Sheets(1) derligne3 = Cells(Rows.Count, 1).End(xlUp).Row For Each Cel In .Range("A2:A" & derligne3) CelSource = Split(Cel.Value, ";") If Cel = ";;;;" Then GoTo suite: Set toto = Range("A2:A" & derligne3) CelSource = toto toto.NumberFormat = "@" For p = 1 To UBound(CelSource) Celsource(p, 1) = CStr (Celsource(p, 1)) Next p toto = Celsource If CelSource(0) >= ladate1 Then If CelSource(0) <= ladate2 Then TabloOK = True f = f + 1 ReDim Preserve Tablo(1 To 5, 1 To f) Tablo(1, f) = CelSource(0) Tablo(2, f) = CelSource(1) Tablo(3, f) = CelSource(2) Tablo(4, f) = CelSource(3) Tablo(5, f) = CelSource(4) End If End If Next Cel End With suite: ActiveWindow.Close SaveChanges:=False If TabloOK True Then Range(Cells(derligne2, 1), Cells(derligne2 + f - 1, 5)).Value _ Application.WorksheetFunction.Transpose(Tablo) Temp = Dir Loop set toto = Nothing MsgBox "Les données sont transférées" Application.ScreenUpdating = True
If CelSource(0) >= ladate1 Then