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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
Public Sub newFormat()
Dim wk_in As Variant 'JE_entrée
Dim wk_out As Variant 'JE_sortie
Dim wk_new As Variant 'JE_new
Dim N As Integer
Dim I As Integer
Dim A As Object
Dim B As Object
'Algo
MsgBox ("Sélectionner le jeu d'essai d'entrée:")
wk_in = Dir(Application.GetOpenFilename("Fichier Excel (*.xls), *.xls"))
MsgBox ("Sélectionner le jeu d'essai de sortie:")
wk_out = Dir(Application.GetOpenFilename("Fichier Excel (*.xls), *.xls"))
MsgBox ("Sélectionner le jeu d'essai au nouveau format:")
wk_new = Dir(Application.GetOpenFilename("Fichier Excel (*.xls), *.xls"))
'--------------------------------------------------------------------
' ONGLETS DE SORTIE |
'--------------------------------------------------------------------
'__________onglet OUT-Matr_1
Workbooks(wk_out).Worksheets("MODACCEPT").Range(Range("B1:G1"), Range("B1:G1").End(xlDown)).Copy Workbooks(wk_new).Worksheets("OUT-Matr_1 MODACCEPT").Range("C2")
'Workbooks(wk_out).Activate
'Worksheets("MODACCEPT").Range("B1:G1", Selection.End(xlDown)).Copy
'Workbooks(wk_new).Activate
'Worksheets("OUT-Matr_1 MODACCEPT").Select
'Range("C2").Select
'ActiveSheet.Paste
For I = 1 To Range("C1").End(xlDown).Row - 1
Cells(I + 1, 1) = "id lig matr " & I
Cells(I + 1, 1).Interior.ColorIndex = 6
Cells(I + 1, 2) = I
Cells(I + 1, 4).NumberFormat = "0.00000000000000000"
Cells(I + 1, 6).NumberFormat = "0.00000000000000000"
If Cells(I + 1, 6).Value = "" Then
Cells(I + 1, 6) = "0.0"
Cells(I + 1, 6).NumberFormat = "0.0"
End If
Cells(I + 1, 7).HorizontalAlignment = xlRight
Next
'Range("C2").Select
Range("C2", Selection.End(xlDown)).Select
Selection.Replace What:="Z1", Replacement:="1", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Selection.Replace What:="Z2", Replacement:="2", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Selection.Replace What:="Z3", Replacement:="3", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Selection.Replace What:="Z4", Replacement:="4", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Selection.Replace What:="sin(S)", Replacement:="61", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Selection.Replace What:="cos(S)", Replacement:="62", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Selection.Replace What:="sin(2S)", Replacement:="63", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Selection.Replace What:="cos(2S)", Replacement:="64", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Selection.Replace What:="t", Replacement:="71", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Selection.Replace What:="R1", Replacement:="101", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Selection.Replace What:="R2", Replacement:="102", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Selection.Replace What:="-", Replacement:=",", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
'__________onglet OUT-Matr_2
Workbooks(wk_out).Activate
Worksheets("TAB_CONV").Select
Range("E2:E6").Select
Set A = Range(Selection, Selection.End(xlToRight))
A.Cells(3, 1).EntireRow.Delete
A.Copy
Workbooks(wk_new).Activate
Worksheets("OUT-Matr_2").Select
Range("B2").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
For I = 1 To Range("B1").End(xlDown).Row - 1
Cells(I + 1, 1) = "id lig matr " & I
Cells(I + 1, 1).Interior.ColorIndex = 6
Next
End Sub |
Partager