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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
| Private Sub CommandButton1_Click()
Unload UserForm2
UserForm1.Show
End Sub
Private Sub CommandButton172_Click()
Unload UserForm2
Dim WB As Workbook
For Each WB In Workbooks
If (WB.Name <> "LAST_SOFT.xls") = True Then
WB.Close SaveChanges:=False
End If
Next
If UserForm1.ComboBox1.Value = "TRANCHE 4" Then
Set WB = Workbooks.Open("\\Atlas.edf.fr\co\45dam-dpn\services.006\sco.001\Exp34\0 Equipe F\Maxime\LAST\LAST_TR4.xls")
WB.Activate
ElseIf UserForm1.ComboBox1.Value = "TRANCHE 2" Then
Set WB = Workbooks.Open("\\Atlas.edf.fr\co\45dam-dpn\services.006\sco.001\Exp34\0 Equipe F\Maxime\LAST\LAST_TR2.xls")
WB.Activate
ElseIf UserForm1.ComboBox1.Value = "TRANCHE 1" Then
Set WB = Workbooks.Open("\\Atlas.edf.fr\co\45dam-dpn\services.006\sco.001\Exp34\0 Equipe F\Maxime\LAST\LAST_TR1.xls")
WB.Activate
ElseIf UserForm1.ComboBox1.Value = "TRANCHE 3" Then
Set WB = Workbooks.Open("\\Atlas.edf.fr\co\45dam-dpn\services.006\sco.001\Exp34\0 Equipe F\Maxime\LAST\LAST_TR3.xls")
WB.Activate
End If
UserForm6.Show
UserForm2.Show
End Sub
Private Sub CommandButton2_Click()
Unload UserForm2
UserForm3.Show
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
MsgBox "Vous ne pouvez pas utiliser ce bouton de fermeture." & Chr(10) _
& "Pour revenir au menu principal, veuillez utiliser le bouton prévu à cet effet"
Cancel = True
End If
End Sub
Private Sub UserForm_Initialize()
Dim R As Range
Dim SP As Object
Dim SHSP As Object
Dim RSP As Object
Dim Ctrl As Control
Dim i As Integer
i = 1
For Each Ctrl In Controls
If i <= 34 Then
Me.MultiPage1.Pages(i - 1).Caption = ActiveWorkbook.Sheets(i + 1).Cells(2, 2).Value
If TypeName(Ctrl) = "Spreadsheet" Then
Set R = ActiveWorkbook.Sheets(i + 1).Range("a1:z100")
R.Copy
Set SP = Ctrl.Object
Set SHSP = SP.Worksheets(1)
Set RSP = SHSP.[a1]
RSP.Select
SHSP.Paste
RSP.Select
Application.CutCopyMode = False
SP.DisplayTitleBar = False
SP.DisplayToolbar = False
Ctrl.Object.Worksheets("Feuil1").Columns(3).AutoFit
Ctrl.Object.Worksheets("Feuil1").Columns(8).AutoFit
Ctrl.Object.Worksheets("Feuil1").Columns(13).AutoFit
Ctrl.Object.Worksheets("Feuil1").Columns(18).AutoFit
Ctrl.Object.Worksheets("Feuil1").Columns(23).AutoFit
Ctrl.Object.Worksheets("Feuil1").Columns(2).AutoFit
Ctrl.Object.Worksheets("Feuil1").Columns(7).AutoFit
Ctrl.Object.Worksheets("Feuil1").Columns(12).AutoFit
Ctrl.Object.Worksheets("Feuil1").Columns(17).AutoFit
Ctrl.Object.Worksheets("Feuil1").Columns(22).AutoFit
Ctrl.Object.Worksheets("Feuil1").Columns(4).AutoFit
Ctrl.Object.Worksheets("Feuil1").Columns(9).AutoFit
Ctrl.Object.Worksheets("Feuil1").Columns(14).AutoFit
Ctrl.Object.Worksheets("Feuil1").Columns(19).AutoFit
Ctrl.Object.Worksheets("Feuil1").Columns(24).AutoFit
Ctrl.Object.Worksheets("Feuil1").Columns(1).ColumnWidth = 4
Ctrl.Object.Worksheets("Feuil1").Columns(6).ColumnWidth = 4
Ctrl.Object.Worksheets("Feuil1").Columns(11).ColumnWidth = 4
Ctrl.Object.Worksheets("Feuil1").Columns(16).ColumnWidth = 4
Ctrl.Object.Worksheets("Feuil1").Columns(21).ColumnWidth = 4
Ctrl.Object.Worksheets("Feuil1").Columns(26).ColumnWidth = 4
Ctrl.Object.Worksheets("Feuil1").Columns(5).ColumnWidth = 5
Ctrl.Object.Worksheets("Feuil1").Columns(10).ColumnWidth = 5
Ctrl.Object.Worksheets("Feuil1").Columns(15).ColumnWidth = 5
Ctrl.Object.Worksheets("Feuil1").Columns(20).ColumnWidth = 5
Ctrl.Object.Worksheets("Feuil1").Columns(25).ColumnWidth = 5
Dim j As Integer
For j = 1 To 110
If Ctrl.Object.Worksheets("Feuil1").Cells(j, 6).Text = "0" Then
Ctrl.Object.Worksheets("Feuil1").Cells(j, 4).Font.ColorIndex = 10
ElseIf Ctrl.Object.Worksheets("Feuil1").Cells(j, 6).Text = "1" Then
Ctrl.Object.Worksheets("Feuil1").Cells(j, 4).Font.ColorIndex = 3
End If
If Ctrl.Object.Worksheets("Feuil1").Cells(j, 11).Text = "0" Then
Ctrl.Object.Worksheets("Feuil1").Cells(j, 9).Font.ColorIndex = 10
ElseIf Ctrl.Object.Worksheets("Feuil1").Cells(j, 11).Text = "1" Then
Ctrl.Object.Worksheets("Feuil1").Cells(j, 9).Font.ColorIndex = 3
End If
If Ctrl.Object.Worksheets("Feuil1").Cells(j, 16).Text = "0" Then
Ctrl.Object.Worksheets("Feuil1").Cells(j, 14).Font.ColorIndex = 10
ElseIf Ctrl.Object.Worksheets("Feuil1").Cells(j, 16).Text = "1" Then
Ctrl.Object.Worksheets("Feuil1").Cells(j, 14).Font.ColorIndex = 3
End If
If Ctrl.Object.Worksheets("Feuil1").Cells(j, 21).Text = "0" Then
Ctrl.Object.Worksheets("Feuil1").Cells(j, 19).Font.ColorIndex = 10
ElseIf Ctrl.Object.Worksheets("Feuil1").Cells(j, 21).Text = "1,00" Then
Ctrl.Object.Worksheets("Feuil1").Cells(j, 19).Font.ColorIndex = 3
End If
If Ctrl.Object.Worksheets("Feuil1").Cells(j, 26).Text = "0" Then
Ctrl.Object.Worksheets("Feuil1").Cells(j, 24).Font.ColorIndex = 10
ElseIf Ctrl.Object.Worksheets("Feuil1").Cells(j, 26).Text = "1" Then
Ctrl.Object.Worksheets("Feuil1").Cells(j, 24).Font.ColorIndex = 3
End If
Next
i = i + 1
End If
End If
Next
End Sub |
Partager