

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim N As Long, Fin As Long
If Target.Count > 1 Then Exit Sub 'quand sélectionne un bloc, sinon bug
Fin = Range("A65536").End(xlUp).Row
If Target.Column < 11 And Target.Row <= Fin And Target.Row > 2 Then
Joueur.Show 1
End If
End Sub
Option Explicit
Dim Lig As Long
Private Sub UserForm_Initialize()
Lig = ActiveCell.Row
RemplirFiche
End Sub
'Retransmettez les données sur la feuille Base, il est possible
'aussi de contrôler si c'est nécessaire.
Private Sub OK_Click()
Dim Cont As Control
Dim N As Integer
Application.ScreenUpdating = False
Application.EnableEvents = False
Sheets("Base").Select
Cells(Lig, 1) = Label1.Caption
'-------------------------------------------------------------
'C'est la routine "écrire" de cette astuce
For Each Cont In Me.Controls
If TypeOf Cont Is MSForms.TextBox Then
N = Val(Right(Cont.Name, 2))
Cells(Lig, N) = Trim(Cont.Object.Text)
End If
Next Cont
'-------------------------------------------------------------
Application.EnableEvents = True
Application.ScreenUpdating = True
Unload Me
End Sub
Sub RemplirFiche()
Dim Cont As Control
Dim N As Integer
Application.ScreenUpdating = False
Application.EnableEvents = False
Sheets("Base").Select
Label1.Caption = Cells(Lig, 1).Value
'-------------------------------------------------------------
'C'est la routine "Lire" de cette astuce
For Each Cont In Me.Controls
If TypeOf Cont Is MSForms.TextBox Then
N = Val(Right(Cont.Name, 2))
Cont.Object.Text = Cells(Lig, N)
End If
Next Cont
'-------------------------------------------------------------
Me.Caption = "Fiche de " & Text02.Text & " " & Text03.Text
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton21_Click()
Dim Obj As OLEObject
'boucle sur les objets de la Feuil1
For Each Obj In Sheets("Feuil1").OLEObjects
'verifie s'il s'agit d'un CheckBox
If TypeOf Obj.Object Is MSForms.CheckBox Then
If Obj.Object.Value = True Then
'Exemple d'action si le checkbox est coché.
N = Val(Right(Obj.Name, 3)) + Lig1
Rows(N).Hidden = True
End If
End If
Next Obj
End Sub
Combien cela coûte-t-il au total ? Quelles aides apportent l'état et les acteurs du marché pour alléger cette charge non choisie ? Tous les détails sur Commentçamarche.net.