problème selection change VBA
Bonjour,
encore une fois, je fais appel aux sauveurs qu'il y a sur ce forum :D
Voila mon souci, j'ai un code dans le wroksheet avec 2 private sub selectionchange. quand j'en met un seul, ça fonctionne mais des que je mets les 2, j'ai "erreur de compilation, nom ambigu"
Voici le code:
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 41 42 43 44 45 46 47 48 49 50 51
| Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("B3:B65556")) Is Nothing Then
UserForm1.TextBox2 = ActiveCell.Value
UserForm1.TextBox1 = ActiveCell.Offset(0, 14).Value
UserForm1.TextBox3 = ActiveCell.Offset(0, 1).Value
UserForm1.TextBox4 = ActiveCell.Offset(0, 2).Value
UserForm1.TextBox5 = ActiveCell.Offset(0, 3).Value
UserForm1.TextBox6 = ActiveCell.Offset(0, 6).Value
UserForm1.TextBox7 = ActiveCell.Offset(0, 5).Value
UserForm1.TextBox8 = ActiveCell.Offset(0, 4).Value
UserForm1.Show
End If
End Sub
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim n&, rg As Range
On Error GoTo fin
Application.ScreenUpdating = False
If Target.Column = 10 Then
With Application.WorksheetFunction
If .CountIf(ActiveSheet.Columns(Target.Column), Target.Value) > 1 Then
Set rg = ActiveSheet.Columns(10).Find( _
What:=Target.Value, After:=Target)
rg.Clear
End If
End With
End If
fin:
Application.ScreenUpdating = True
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
If Not Application.Intersect(Target, Range("L5:L33333")) Is Nothing Then 'modifie ton tableau
If Target.Value = "EN ATTENTE" Then
Target.Value = "ACTIVE"
Else
Target.Value = "EN ATTENTE"
End If
End If
End Sub |
Encore une fois, je remercie d'avance ceux qui se pencheront sur mon problème :?