Un seul code pour toutes les feuilles
Bonjour,
Actuellement j'utilise ce code que j'ai copié dans chacune des feuilles de calcul. J'aimerai avoir un seul code, sous la forme d'un module, qui me sert pour toutes les feuilles. Les feuilles commençant par un "L" sont activées à partir d'un UF (UFEngt) et d'un Combo (CmbListCred).
Pouvez-vous m'apporter votre aide s'il vous plait ? Merci par avance
Code:
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
|
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'On Error GoTo fin
If Not Intersect([A12:A39], Target) Is Nothing Then
Dim FNew As Worksheet, Wb As Workbook, Sh As Worksheet
Const Cible As String = "F24"
Set Wb = ThisWorkbook
On Error Resume Next
Set FNew = Wb.Worksheets(Cible)
On Error GoTo fin
If Not FNew Is Nothing Then
FNew.Activate
FNew.Visible = True
Else
GoTo fin
End If
' on masque les feuilles
For Each Sh In Wb.Worksheets
If FNew.name <> Cible Then
If FNew.name <> "L24" Then
FNew.Visible = xlSheetVeryHidden
End If
End If
Next Sh
FNew.Cells((Target.Value - 1) * 41 + 2, 3).Select
'Application.GoTo reference:=
End If
FNew.Rows("1:1185").Hidden = True
FNew.Range(FNew.Cells((Target.Value - 1) * 41 + 2, 3), FNew.Cells((Target.Value - 1) * 41 + 1 + 38, 3)).EntireRow.Hidden = False
FNew.Cells((Target.Value - 1) * 41 + 2, 3).Select
fin:
Set FNew = Nothing: Set Wb = Nothing: Set Sh = Nothing
End Sub |