Ambiguous name detected: worksheet_change en VBA excel
Résolu
Dianex87
Messages postés
79
Date d'inscription
Statut
Membre
Dernière intervention
-
Dianex87 Messages postés 79 Date d'inscription Statut Membre Dernière intervention -
Dianex87 Messages postés 79 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
J'ai sur le même Worksheet les 2 macro suivantes :
Private Sub Worksheet_Change(ByVal sel As Range)
'Column A is autofilled with the date of the last line update
If sel.Row > 2 Then
Application.EnableEvents = False
Cells(sel.Row, "A").Value = Date
Application.EnableEvents = True
End If
End Sub
ET
Private Sub Worksheet_Change(ByVal Target As Range)
'When a new row is created, column B is autofilled with the creation of the date
Range("B" & Target.Row).Value = Now
End Sub
Et les 2 ne peuvent visiblement pas fonctionner car étant sur le meme sheet; j'ai le message suivant: Ambiguous name detected worksheet_change.
J'ai besoin des 2; quelqu'un aurait-il la solution SVP?
Merci bcp,
Dianex
J'ai sur le même Worksheet les 2 macro suivantes :
Private Sub Worksheet_Change(ByVal sel As Range)
'Column A is autofilled with the date of the last line update
If sel.Row > 2 Then
Application.EnableEvents = False
Cells(sel.Row, "A").Value = Date
Application.EnableEvents = True
End If
End Sub
ET
Private Sub Worksheet_Change(ByVal Target As Range)
'When a new row is created, column B is autofilled with the creation of the date
Range("B" & Target.Row).Value = Now
End Sub
Et les 2 ne peuvent visiblement pas fonctionner car étant sur le meme sheet; j'ai le message suivant: Ambiguous name detected worksheet_change.
J'ai besoin des 2; quelqu'un aurait-il la solution SVP?
Merci bcp,
Dianex
A voir également:
- Ambiguous name detected worksheet_change
- No keyboard detected - Forum Clavier
- Usb device over current status detected ✓ - Forum Matériel & Système
- Boot failure detected - Guide
- Warning!!! USB device over current detected!! - Forum Matériel & Système
- Invalid signature detected check secure boot policy in setup - Forum Windows 10
1 réponse
bonjour,
comme ceci:
comme ceci:
Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) Dim changement As Boolean If Target.Rows(1).Cells.Count = Columns.Count Then changement = True If Target.Columns(1).Cells.Count = Rows.Count Then changement = True If changement = True Then Range("B" & Target.Row).Value = Now End If If Target.Row > 2 Then Application.EnableEvents = False Cells(Target.Row, "A").Value = Date Application.EnableEvents = True End If End Sub
Cela fonctionne