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
| Private Declare Function GetWindowLongA Lib "User32" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLongA Lib "User32" _
(ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function FindWindowA Lib "User32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Option Compare Text
Option Explicit
Dim i As Byte
Private Sub CommandButton3_Click()
Unload Me
' ActiveSheet.Protect "*69*", UserInterfaceOnly:=True
Sheets("Gestion bobine").Select
End Sub
Private Sub CommandButton4_Click()
Dim lig
If TextBox1.Value = "" Then MsgBox "Format invalide !": Exit Sub
If TextBox2.Value = "" Then MsgBox "Format invalide !": Exit Sub
If TextBox3.Value = "" Then MsgBox "Format invalide !": Exit Sub
If TextBox4.Value = "" Then MsgBox "Format invalide !": Exit Sub
If TextBox5.Value = "" Then MsgBox "Format invalide !": Exit Sub
If TextBox6.Value = "" Then MsgBox "Format invalide !": Exit Sub
If TextBox7.Value = "" Then MsgBox "Format invalide !": Exit Sub
If TextBox8.Value = "" Then MsgBox "Format invalide !": Exit Sub
If TextBox9.Value = "" Then MsgBox "Format invalide !": Exit Sub
If TextBox10.Value = "" Then MsgBox "Format invalide !": Exit Sub
If TextBox11.Value = "" Then MsgBox "Format invalide !": Exit Sub
With Sheets("BASE")
For i = 3 To 16 ' boucle sur les contrôles
If i = 1 Or i = 2 Or i = 3 Or i = 4 Or i = 5 Or i = 6 Or i = 7 Or i = 8 Or i = 9 Or i = 10 Or i = 11 Then
.Cells(lig, i) = Me.Controls("TextBox" & i - 2).Value
End If
Next i
End With
Unload Me
'ActiveSheet.Protect "*69*", UserInterfaceOnly:=True
Sheets("Gestion bobine").Select
'ActiveWorkbook.Save
End Sub
Private Sub CommandButton5_Click()
Dim lig
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox4.Value = ""
TextBox5.Value = ""
TextBox6.Value = ""
TextBox7.Value = ""
TextBox8.Value = ""
TextBox9.Value = ""
TextBox10.Value = ""
TextBox11.Value = ""
With Sheets("BASE")
For i = 3 To 16 ' boucle sur les contrôles
If i = 1 Or i = 2 Or i = 3 Or i = 4 Or i = 5 Or i = 6 Or i = 7 Or i = 8 Or i = 9 Or i = 10 Or i = 11 Then
.Cells(lig, i) = Me.Controls("TextBox" & i - 2).Value
End If
Next i
End With
Unload Me
'ActiveSheet.Protect "*69*", UserInterfaceOnly:=True
Sheets("Gestion bobine").Select
'ActiveWorkbook.Save
End Sub
Private Sub UserForm_Initialize()
Dim hWnd As Long
Dim lig As String
hWnd = FindWindowA("Thunder" & IIf(Application.Version Like "8*", _
"X", "D") & "Frame", Me.Caption)
SetWindowLongA hWnd, -16, GetWindowLongA(hWnd, -16) And &HFFF7FFFF
'Chargement des valeurs de la Feuil1 dans les TextBox et les ComboBox
With Sheets("BASE")
lig = ActiveCell.Row
For i = 3 To 16 ' boucle sur les contrôles
If (i = 1 Or i = 2 Or i = 3 Or i = 4 Or i = 5 Or i = 6 Or i = 7 Or i = 8 Or i = 9 Or i = 10 Or i = 11 Or i = 12 Or i = 13) And .Cells(lig, i) <> "" Then
Me.Controls("TextBox" & i - 2) = .Cells(lig, i)
End If
Next i
End With
End Sub |
Partager