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
| Sub test()
Dim SHimport As Worksheet, SHordi2 As Worksheet, Wbk As Workbook, comm As Byte
Application.ScreenUpdating = False
Set SHimport = ThisWorkbook.Sheets("importation")
Workbooks.OpenText Filename:="C:\Documents and Settings\All Users\Documents\MS_direct_ordi2\bb_1_5_15_ordi2.txt", _
Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(1, 1)
Set Wbk = ActiveWorkbook
Set SHordi2 = ActiveWorkbook.ActiveSheet
With SHimport
.Range("AE75:AM115").ClearContents
.Cells(75, 31) = SHordi2.Cells(1, 1) '<- importe l'isin
.Cells(75, 32) = SHordi2.Cells(2, 1) '<- importe la date et l'heure de crétion
For comm = 3 To 7
.Cells(76, 28 + comm) = SHordi2.Cells(comm, 1)
.Cells(77, 28 + comm) = SHordi2.Cells(comm + 5, 1)
.Cells(78, 28 + comm) = SHordi2.Cells(comm + 10, 1)
Next
End With
Wbk.Saved = True
Wbk.Close
Set Wbk = Nothing
Set SHimport = Nothing
Set SHordi2 = Nothing
Application.ScreenUpdating = True
End Sub |
Partager