'
Private Sub Worksheet_Change(ByVal Target As Range)
'1ere code-------------------------------------------------
Dim mem, sel As Range
If Target.Areas.Count = 1 Then
Application.EnableEvents = False
mem = Target.Formula
Set sel = Selection
Application.Undo
Target = mem
sel.Select
Application.EnableEvents = True
End If
'----------------------------------------------------------------
'2 eme code-------------------------------------------------
If Target.Column = 18 And Target(1) = "Achevée" _
Then Target(1, 21) = Date
If Target.Column = 18 And Target(1) <> "Achevée" _
Then Target(1, 21) = ""
'----------------------------------------------------------------
'3 eme code-------------------------------------------------
If Intersect(Target, [E5:E25]) Is Nothing Then Exit Sub
Dim ntab&, lettre$, n&, i&
Target.Select
Application.ScreenUpdating = False
ntab = Val([E5])
Rows("6:2066").Hidden = True
For ntab = 1 To ntab
Rows(4 + 2 * ntab).Resize(2).Hidden = False
lettre = Chr(64 + ntab)
n = Val([E5].Offset(2 * ntab))
i = Application.Match(lettre, [A:A], 0) - 1
Rows(i & ":" & i + 2 * n + 1).Hidden = False
i = Application.Match("Total " & lettre, [A:A], 0) - 1
Rows(i).Resize(2).Hidden = False
Next
'---------------------------------------------------------------------
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Static flag As Boolean 'mémorise la variable
If flag Then Exit Sub
flag = True
'1ere code-------------------------------------------------
Dim mem, sel As Range
If Target.Areas.Count = 1 Then
mem = Target.Formula
Set sel = Selection
Application.Undo
Target = mem
sel.Select
End If
'----------------------------------------------------------------
'2 eme code-------------------------------------------------
If Target.Column = 18 And Target(1) = "Achevée" _
Then Target(1, 21) = Date
If Target.Column = 18 And Target(1) <> "Achevée" _
Then Target(1, 21) = ""
'----------------------------------------------------------------
'3 eme code-------------------------------------------------
If Not Intersect(Target, [E5:E25]) Is Nothing Then
Dim ntab&, lettre$, n&, i&
Target.Select
Application.ScreenUpdating = False
ntab = Val([E5])
Rows("6:2066").Hidden = True
For ntab = 1 To ntab
Rows(4 + 2 * ntab).Resize(2).Hidden = False
lettre = Chr(64 + ntab)
n = Val([E5].Offset(2 * ntab))
i = Application.Match(lettre, [A:A], 0) - 1
Rows(i & ":" & i + 2 * n + 1).Hidden = False
i = Application.Match("Total " & lettre, [A:A], 0) - 1
Rows(i).Resize(2).Hidden = False
Next
End If
'---------------------------------------------------------------------
flag = False
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
On Error Resume Next 'sécurité
'1ere code-------------------------------------------------
Dim mem, sel As Range
If Target.Areas.Count = 1 Then
mem = Target.Formula
Set sel = Selection
Application.Undo
Target = mem
sel.Select
End If
'----------------------------------------------------------------
'2 eme code-------------------------------------------------
If Target.Column = 18 And Target(1) = "Achevée" _
Then Target(1, 21) = Date
If Target.Column = 18 And Target(1) <> "Achevée" _
Then Target(1, 21) = ""
'----------------------------------------------------------------
'3 eme code-------------------------------------------------
If Not Intersect(Target, [E5:E25]) Is Nothing Then
Dim ntab&, lettre$, n&, i&
Target.Select
Application.ScreenUpdating = False
ntab = Val([E5])
Rows("6:2066").Hidden = True
For ntab = 1 To ntab
Rows(4 + 2 * ntab).Resize(2).Hidden = False
lettre = Chr(64 + ntab)
n = Val([E5].Offset(2 * ntab))
i = Application.Match(lettre, [A:A], 0) - 1
Rows(i & ":" & i + 2 * n + 1).Hidden = False
i = Application.Match("Total " & lettre, [A:A], 0) - 1
Rows(i).Resize(2).Hidden = False
Next
End If
'---------------------------------------------------------------------
Application.EnableEvents = True
End Sub
je n'arrive pas a declarer deux variable dans
Private Sub Worksheet_Change(ByVal c As Range, ByVal Target As Range) ???
Private Sub Worksheet_SelectionChange(ByVal Target As Range, ByVal c As Range)
Target.Name = "Cible" 'coller texte sans modifier le format cellule
If ActiveSheet.Name = "FGP 2014" Then
With ActiveSheet.Shapes("CommandButton109")
.Top = c.Top - 25
.Left = c.Left + 150
End With
With ActiveSheet.Shapes("CommandButton15")
.Top = c.Top - 25
.Left = c.Left + 195
End With
End If
End Sub