Après bien du mal, j'ai réussi à combiner, avec l'aide de certains d'entre
vous, les codes qui permettent à la fois d'écrire dans une liste déroulante
(en ajoutant ou non l'item à la liste initiale), et de voir les commentaires
saisie dans la liste intiale après validation. Ouf...
Je me pose une question: Comme je dois appliquer ce code à divers liste pour
une même feuille, dois-je réécrire le code pour chaque liste, ou faut-il
rester dans le même code?
Le voici:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$2" Then
If IsError(Application.Match(Target.Value, [niveaux], 0)) Then
If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then
[niveaux].End(xlDown).Offset(1, 0) = Target.Value
Sheets("Infos").[niveaux].Sort key1:=Sheets("Infos").Range("F2")
End If
End If
End If
If Target.Address = "$A$2" Then
If [niveaux].Cells(Application.Match(Target, [niveaux], 0)).Comment Is
Nothing Then
If Not Target.Comment Is Nothing Then Target.Comment.Delete
Else
If Target.Comment Is Nothing Then Target.AddComment
Target.Comment.Text [niveaux].Cells(Application.Match(Target,
[niveaux], 0)). _
Comment.Text
End If
End If
End Sub
Sauriez-vous me donner un exemple, si toutefois il fallait rester dans le
même code, pour la cellule H2 qui irait chercher la liste nommé "types"
dans la feuille nommée "Infos"?
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Corto
Bonjour Greg, Si tes listes sont toutes dans le même classeur le mieux est à mon av is d'utiliser l'événement de ThisWorkbook Workbook_SheetChange. Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Rang e) If Sh.Name <> "niveau" Then If Target.Address = "$A$2" Then If IsError(Application.Match(Target.Value, [niveaux], 0)) Then If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then [niveaux].End(xlDown).Offset(1, 0) = Target.Value Sheets("Infos").[niveaux].Sort key1:=Sheets("Infos").Range("F2") End If End If End If If Target.Address = "$A$2" Then If [niveaux].Cells(Application.Match(Target, [niveaux], 0)).Comment Is Nothing Then If Not Target.Comment Is Nothing Then Target.Comment.Delet e Else If Target.Comment Is Nothing Then Target.AddComment Target.Comment.Text [niveaux].Cells(Application.Match(Target, [niveaux], 0)). _ Comment.Text End If End If End If End Sub
Corto
Greg a écrit :
Après bien du mal, j'ai réussi à combiner, avec l'aide de certain s d'entre vous, les codes qui permettent à la fois d'écrire dans une liste dé roulante (en ajoutant ou non l'item à la liste initiale), et de voir les comme ntaires saisie dans la liste intiale après validation. Ouf...
Je me pose une question: Comme je dois appliquer ce code à divers lis te pour une même feuille, dois-je réécrire le code pour chaque liste, ou faut-il rester dans le même code?
Le voici:
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$2" Then If IsError(Application.Match(Target.Value, [niveaux], 0)) Then If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then [niveaux].End(xlDown).Offset(1, 0) = Target.Value Sheets("Infos").[niveaux].Sort key1:=Sheets("Infos").Range("F2 ") End If End If End If If Target.Address = "$A$2" Then If [niveaux].Cells(Application.Match(Target, [niveaux], 0)).Comment Is Nothing Then If Not Target.Comment Is Nothing Then Target.Comment.Delete Else If Target.Comment Is Nothing Then Target.AddComment Target.Comment.Text [niveaux].Cells(Application.Match(Target, [niveaux], 0)). _ Comment.Text End If End If End Sub
Sauriez-vous me donner un exemple, si toutefois il fallait rester dans le même code, pour la cellule H2 qui irait chercher la liste nommé "t ypes" dans la feuille nommée "Infos"?
Bonjour Greg,
Si tes listes sont toutes dans le même classeur le mieux est à mon av is
d'utiliser l'événement de ThisWorkbook Workbook_SheetChange.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Rang e)
If Sh.Name <> "niveau" Then
If Target.Address = "$A$2" Then
If IsError(Application.Match(Target.Value, [niveaux], 0)) Then
If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then
[niveaux].End(xlDown).Offset(1, 0) = Target.Value
Sheets("Infos").[niveaux].Sort
key1:=Sheets("Infos").Range("F2")
End If
End If
End If
If Target.Address = "$A$2" Then
If [niveaux].Cells(Application.Match(Target, [niveaux],
0)).Comment Is Nothing Then
If Not Target.Comment Is Nothing Then Target.Comment.Delet e
Else
If Target.Comment Is Nothing Then Target.AddComment
Target.Comment.Text
[niveaux].Cells(Application.Match(Target, [niveaux], 0)). _
Comment.Text
End If
End If
End If
End Sub
Corto
Greg a écrit :
Après bien du mal, j'ai réussi à combiner, avec l'aide de certain s d'entre
vous, les codes qui permettent à la fois d'écrire dans une liste dé roulante
(en ajoutant ou non l'item à la liste initiale), et de voir les comme ntaires
saisie dans la liste intiale après validation. Ouf...
Je me pose une question: Comme je dois appliquer ce code à divers lis te pour
une même feuille, dois-je réécrire le code pour chaque liste, ou faut-il
rester dans le même code?
Le voici:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$2" Then
If IsError(Application.Match(Target.Value, [niveaux], 0)) Then
If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then
[niveaux].End(xlDown).Offset(1, 0) = Target.Value
Sheets("Infos").[niveaux].Sort key1:=Sheets("Infos").Range("F2 ")
End If
End If
End If
If Target.Address = "$A$2" Then
If [niveaux].Cells(Application.Match(Target, [niveaux], 0)).Comment Is
Nothing Then
If Not Target.Comment Is Nothing Then Target.Comment.Delete
Else
If Target.Comment Is Nothing Then Target.AddComment
Target.Comment.Text [niveaux].Cells(Application.Match(Target,
[niveaux], 0)). _
Comment.Text
End If
End If
End Sub
Sauriez-vous me donner un exemple, si toutefois il fallait rester dans le
même code, pour la cellule H2 qui irait chercher la liste nommé "t ypes"
dans la feuille nommée "Infos"?
Bonjour Greg, Si tes listes sont toutes dans le même classeur le mieux est à mon av is d'utiliser l'événement de ThisWorkbook Workbook_SheetChange. Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Rang e) If Sh.Name <> "niveau" Then If Target.Address = "$A$2" Then If IsError(Application.Match(Target.Value, [niveaux], 0)) Then If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then [niveaux].End(xlDown).Offset(1, 0) = Target.Value Sheets("Infos").[niveaux].Sort key1:=Sheets("Infos").Range("F2") End If End If End If If Target.Address = "$A$2" Then If [niveaux].Cells(Application.Match(Target, [niveaux], 0)).Comment Is Nothing Then If Not Target.Comment Is Nothing Then Target.Comment.Delet e Else If Target.Comment Is Nothing Then Target.AddComment Target.Comment.Text [niveaux].Cells(Application.Match(Target, [niveaux], 0)). _ Comment.Text End If End If End If End Sub
Corto
Greg a écrit :
Après bien du mal, j'ai réussi à combiner, avec l'aide de certain s d'entre vous, les codes qui permettent à la fois d'écrire dans une liste dé roulante (en ajoutant ou non l'item à la liste initiale), et de voir les comme ntaires saisie dans la liste intiale après validation. Ouf...
Je me pose une question: Comme je dois appliquer ce code à divers lis te pour une même feuille, dois-je réécrire le code pour chaque liste, ou faut-il rester dans le même code?
Le voici:
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$2" Then If IsError(Application.Match(Target.Value, [niveaux], 0)) Then If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then [niveaux].End(xlDown).Offset(1, 0) = Target.Value Sheets("Infos").[niveaux].Sort key1:=Sheets("Infos").Range("F2 ") End If End If End If If Target.Address = "$A$2" Then If [niveaux].Cells(Application.Match(Target, [niveaux], 0)).Comment Is Nothing Then If Not Target.Comment Is Nothing Then Target.Comment.Delete Else If Target.Comment Is Nothing Then Target.AddComment Target.Comment.Text [niveaux].Cells(Application.Match(Target, [niveaux], 0)). _ Comment.Text End If End If End Sub
Sauriez-vous me donner un exemple, si toutefois il fallait rester dans le même code, pour la cellule H2 qui irait chercher la liste nommé "t ypes" dans la feuille nommée "Infos"?
Greg
Merci Corto!
Non formé au code et n'arrivant qu'à bidouiller 2, 3 trucs, je ne vois toujours pas comment insérer une autre liste. Peux-tu me donner un exemple? Pour reprendre la fin de mon précédent message::
"Sauriez-vous me donner un exemple, ..., pour la cellule H2 qui irait chercher la liste nommé "types" dans la feuille nommée "Infos"? "
Merci
Greg
"Corto" a écrit dans le message de news:
Bonjour Greg, Si tes listes sont toutes dans le même classeur le mieux est à mon avis d'utiliser l'événement de ThisWorkbook Workbook_SheetChange. Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) If Sh.Name <> "niveau" Then If Target.Address = "$A$2" Then If IsError(Application.Match(Target.Value, [niveaux], 0)) Then If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then [niveaux].End(xlDown).Offset(1, 0) = Target.Value Sheets("Infos").[niveaux].Sort key1:=Sheets("Infos").Range("F2") End If End If End If If Target.Address = "$A$2" Then If [niveaux].Cells(Application.Match(Target, [niveaux], 0)).Comment Is Nothing Then If Not Target.Comment Is Nothing Then Target.Comment.Delete Else If Target.Comment Is Nothing Then Target.AddComment Target.Comment.Text [niveaux].Cells(Application.Match(Target, [niveaux], 0)). _ Comment.Text End If End If End If End Sub
Corto
Greg a écrit :
Après bien du mal, j'ai réussi à combiner, avec l'aide de certains d'entre vous, les codes qui permettent à la fois d'écrire dans une liste déroulante (en ajoutant ou non l'item à la liste initiale), et de voir les commentaires saisie dans la liste intiale après validation. Ouf...
Je me pose une question: Comme je dois appliquer ce code à divers liste pour une même feuille, dois-je réécrire le code pour chaque liste, ou faut-il rester dans le même code?
Le voici:
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$2" Then If IsError(Application.Match(Target.Value, [niveaux], 0)) Then If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then [niveaux].End(xlDown).Offset(1, 0) = Target.Value Sheets("Infos").[niveaux].Sort key1:=Sheets("Infos").Range("F2") End If End If End If If Target.Address = "$A$2" Then If [niveaux].Cells(Application.Match(Target, [niveaux], 0)).Comment Is Nothing Then If Not Target.Comment Is Nothing Then Target.Comment.Delete Else If Target.Comment Is Nothing Then Target.AddComment Target.Comment.Text [niveaux].Cells(Application.Match(Target, [niveaux], 0)). _ Comment.Text End If End If End Sub
Sauriez-vous me donner un exemple, si toutefois il fallait rester dans le même code, pour la cellule H2 qui irait chercher la liste nommé "types" dans la feuille nommée "Infos"?
Merci Corto!
Non formé au code et n'arrivant qu'à bidouiller 2, 3 trucs, je ne vois
toujours pas comment insérer une autre liste. Peux-tu me donner un exemple?
Pour reprendre la fin de mon précédent message::
"Sauriez-vous me donner un exemple, ..., pour la cellule H2 qui irait
chercher la liste nommé "types" dans la feuille nommée "Infos"? "
Merci
Greg
"Corto" <fcdirckx@hotmail.com> a écrit dans le message de news:
eYeUgM7SJHA.1148@TK2MSFTNGP05.phx.gbl...
Bonjour Greg,
Si tes listes sont toutes dans le même classeur le mieux est à mon avis
d'utiliser l'événement de ThisWorkbook Workbook_SheetChange.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Sh.Name <> "niveau" Then
If Target.Address = "$A$2" Then
If IsError(Application.Match(Target.Value, [niveaux], 0)) Then
If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then
[niveaux].End(xlDown).Offset(1, 0) = Target.Value
Sheets("Infos").[niveaux].Sort
key1:=Sheets("Infos").Range("F2")
End If
End If
End If
If Target.Address = "$A$2" Then
If [niveaux].Cells(Application.Match(Target, [niveaux],
0)).Comment Is Nothing Then
If Not Target.Comment Is Nothing Then Target.Comment.Delete
Else
If Target.Comment Is Nothing Then Target.AddComment
Target.Comment.Text
[niveaux].Cells(Application.Match(Target, [niveaux], 0)). _
Comment.Text
End If
End If
End If
End Sub
Corto
Greg a écrit :
Après bien du mal, j'ai réussi à combiner, avec l'aide de certains d'entre
vous, les codes qui permettent à la fois d'écrire dans une liste
déroulante (en ajoutant ou non l'item à la liste initiale), et de voir les
commentaires saisie dans la liste intiale après validation. Ouf...
Je me pose une question: Comme je dois appliquer ce code à divers liste
pour une même feuille, dois-je réécrire le code pour chaque liste, ou
faut-il rester dans le même code?
Le voici:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$2" Then
If IsError(Application.Match(Target.Value, [niveaux], 0)) Then
If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then
[niveaux].End(xlDown).Offset(1, 0) = Target.Value
Sheets("Infos").[niveaux].Sort key1:=Sheets("Infos").Range("F2")
End If
End If
End If
If Target.Address = "$A$2" Then
If [niveaux].Cells(Application.Match(Target, [niveaux], 0)).Comment Is
Nothing Then
If Not Target.Comment Is Nothing Then Target.Comment.Delete
Else
If Target.Comment Is Nothing Then Target.AddComment
Target.Comment.Text [niveaux].Cells(Application.Match(Target,
[niveaux], 0)). _
Comment.Text
End If
End If
End Sub
Sauriez-vous me donner un exemple, si toutefois il fallait rester dans le
même code, pour la cellule H2 qui irait chercher la liste nommé "types"
dans la feuille nommée "Infos"?
Non formé au code et n'arrivant qu'à bidouiller 2, 3 trucs, je ne vois toujours pas comment insérer une autre liste. Peux-tu me donner un exemple? Pour reprendre la fin de mon précédent message::
"Sauriez-vous me donner un exemple, ..., pour la cellule H2 qui irait chercher la liste nommé "types" dans la feuille nommée "Infos"? "
Merci
Greg
"Corto" a écrit dans le message de news:
Bonjour Greg, Si tes listes sont toutes dans le même classeur le mieux est à mon avis d'utiliser l'événement de ThisWorkbook Workbook_SheetChange. Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) If Sh.Name <> "niveau" Then If Target.Address = "$A$2" Then If IsError(Application.Match(Target.Value, [niveaux], 0)) Then If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then [niveaux].End(xlDown).Offset(1, 0) = Target.Value Sheets("Infos").[niveaux].Sort key1:=Sheets("Infos").Range("F2") End If End If End If If Target.Address = "$A$2" Then If [niveaux].Cells(Application.Match(Target, [niveaux], 0)).Comment Is Nothing Then If Not Target.Comment Is Nothing Then Target.Comment.Delete Else If Target.Comment Is Nothing Then Target.AddComment Target.Comment.Text [niveaux].Cells(Application.Match(Target, [niveaux], 0)). _ Comment.Text End If End If End If End Sub
Corto
Greg a écrit :
Après bien du mal, j'ai réussi à combiner, avec l'aide de certains d'entre vous, les codes qui permettent à la fois d'écrire dans une liste déroulante (en ajoutant ou non l'item à la liste initiale), et de voir les commentaires saisie dans la liste intiale après validation. Ouf...
Je me pose une question: Comme je dois appliquer ce code à divers liste pour une même feuille, dois-je réécrire le code pour chaque liste, ou faut-il rester dans le même code?
Le voici:
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$2" Then If IsError(Application.Match(Target.Value, [niveaux], 0)) Then If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then [niveaux].End(xlDown).Offset(1, 0) = Target.Value Sheets("Infos").[niveaux].Sort key1:=Sheets("Infos").Range("F2") End If End If End If If Target.Address = "$A$2" Then If [niveaux].Cells(Application.Match(Target, [niveaux], 0)).Comment Is Nothing Then If Not Target.Comment Is Nothing Then Target.Comment.Delete Else If Target.Comment Is Nothing Then Target.AddComment Target.Comment.Text [niveaux].Cells(Application.Match(Target, [niveaux], 0)). _ Comment.Text End If End If End Sub
Sauriez-vous me donner un exemple, si toutefois il fallait rester dans le même code, pour la cellule H2 qui irait chercher la liste nommé "types" dans la feuille nommée "Infos"?
Fredo P.
En exemple ici http://cjoint.com/?lvoFCWzQmQ Le code a été simplifié, pour ce qui est de l'extension des plages, elles sont automatiques. Ne sachant pas ce qui s'y trouve en F2 , j'ai mis la ligne en Rem
Private Sub Worksheet_Change(ByVal Target As Range) Dim Lst$ Lst = Range("B2").Value If Target.Address = "$A$2" Then If IsError(Application.Match(Target.Value, Sheets("Infos").Range(Lst), 0)) Then If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then Sheets("Infos").Range(Lst)(2).Insert Shift:=xlDown Target.Copy Sheets("Infos").Range(Lst)(2).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :úlse, Transpose:úlse
[A2].Select ' Sheets("Infos").Range(Lst).Sort key1:=Sheets("Infos").Range("F2") 'feuil2.range(lst).address End If End If End If End Sub
"Greg" a écrit dans le message de news:4925848a$0$3458$
Après bien du mal, j'ai réussi à combiner, avec l'aide de certains d'entre vous, les codes qui permettent à la fois d'écrire dans une liste
déroulante
(en ajoutant ou non l'item à la liste initiale), et de voir les
commentaires
saisie dans la liste intiale après validation. Ouf...
Je me pose une question: Comme je dois appliquer ce code à divers liste
pour
une même feuille, dois-je réécrire le code pour chaque liste, ou faut-il rester dans le même code?
Le voici:
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$2" Then If IsError(Application.Match(Target.Value, [niveaux], 0)) Then If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then [niveaux].End(xlDown).Offset(1, 0) = Target.Value Sheets("Infos").[niveaux].Sort key1:=Sheets("Infos").Range("F2") End If End If End If If Target.Address = "$A$2" Then If [niveaux].Cells(Application.Match(Target, [niveaux], 0)).Comment Is Nothing Then If Not Target.Comment Is Nothing Then Target.Comment.Delete Else If Target.Comment Is Nothing Then Target.AddComment Target.Comment.Text [niveaux].Cells(Application.Match(Target, [niveaux], 0)). _ Comment.Text End If End If End Sub
Sauriez-vous me donner un exemple, si toutefois il fallait rester dans le même code, pour la cellule H2 qui irait chercher la liste nommé "types" dans la feuille nommée "Infos"?
En exemple ici
http://cjoint.com/?lvoFCWzQmQ
Le code a été simplifié, pour ce qui est de l'extension des plages, elles
sont automatiques.
Ne sachant pas ce qui s'y trouve en F2 , j'ai mis la ligne en Rem
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Lst$
Lst = Range("B2").Value
If Target.Address = "$A$2" Then
If IsError(Application.Match(Target.Value, Sheets("Infos").Range(Lst),
0)) Then
If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then
Sheets("Infos").Range(Lst)(2).Insert Shift:=xlDown
Target.Copy
Sheets("Infos").Range(Lst)(2).PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:úlse, Transpose:úlse
[A2].Select
' Sheets("Infos").Range(Lst).Sort key1:=Sheets("Infos").Range("F2")
'feuil2.range(lst).address
End If
End If
End If
End Sub
"Greg" <delboe@free.fr> a écrit dans le message de
news:4925848a$0$3458$426a74cc@news.free.fr...
Après bien du mal, j'ai réussi à combiner, avec l'aide de certains d'entre
vous, les codes qui permettent à la fois d'écrire dans une liste
déroulante
(en ajoutant ou non l'item à la liste initiale), et de voir les
commentaires
saisie dans la liste intiale après validation. Ouf...
Je me pose une question: Comme je dois appliquer ce code à divers liste
pour
une même feuille, dois-je réécrire le code pour chaque liste, ou faut-il
rester dans le même code?
Le voici:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$2" Then
If IsError(Application.Match(Target.Value, [niveaux], 0)) Then
If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then
[niveaux].End(xlDown).Offset(1, 0) = Target.Value
Sheets("Infos").[niveaux].Sort key1:=Sheets("Infos").Range("F2")
End If
End If
End If
If Target.Address = "$A$2" Then
If [niveaux].Cells(Application.Match(Target, [niveaux], 0)).Comment Is
Nothing Then
If Not Target.Comment Is Nothing Then Target.Comment.Delete
Else
If Target.Comment Is Nothing Then Target.AddComment
Target.Comment.Text [niveaux].Cells(Application.Match(Target,
[niveaux], 0)). _
Comment.Text
End If
End If
End Sub
Sauriez-vous me donner un exemple, si toutefois il fallait rester dans le
même code, pour la cellule H2 qui irait chercher la liste nommé "types"
dans la feuille nommée "Infos"?
En exemple ici http://cjoint.com/?lvoFCWzQmQ Le code a été simplifié, pour ce qui est de l'extension des plages, elles sont automatiques. Ne sachant pas ce qui s'y trouve en F2 , j'ai mis la ligne en Rem
Private Sub Worksheet_Change(ByVal Target As Range) Dim Lst$ Lst = Range("B2").Value If Target.Address = "$A$2" Then If IsError(Application.Match(Target.Value, Sheets("Infos").Range(Lst), 0)) Then If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then Sheets("Infos").Range(Lst)(2).Insert Shift:=xlDown Target.Copy Sheets("Infos").Range(Lst)(2).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :úlse, Transpose:úlse
[A2].Select ' Sheets("Infos").Range(Lst).Sort key1:=Sheets("Infos").Range("F2") 'feuil2.range(lst).address End If End If End If End Sub
"Greg" a écrit dans le message de news:4925848a$0$3458$
Après bien du mal, j'ai réussi à combiner, avec l'aide de certains d'entre vous, les codes qui permettent à la fois d'écrire dans une liste
déroulante
(en ajoutant ou non l'item à la liste initiale), et de voir les
commentaires
saisie dans la liste intiale après validation. Ouf...
Je me pose une question: Comme je dois appliquer ce code à divers liste
pour
une même feuille, dois-je réécrire le code pour chaque liste, ou faut-il rester dans le même code?
Le voici:
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$2" Then If IsError(Application.Match(Target.Value, [niveaux], 0)) Then If MsgBox("On ajoute à la liste?", vbYesNo) = vbYes Then [niveaux].End(xlDown).Offset(1, 0) = Target.Value Sheets("Infos").[niveaux].Sort key1:=Sheets("Infos").Range("F2") End If End If End If If Target.Address = "$A$2" Then If [niveaux].Cells(Application.Match(Target, [niveaux], 0)).Comment Is Nothing Then If Not Target.Comment Is Nothing Then Target.Comment.Delete Else If Target.Comment Is Nothing Then Target.AddComment Target.Comment.Text [niveaux].Cells(Application.Match(Target, [niveaux], 0)). _ Comment.Text End If End If End Sub
Sauriez-vous me donner un exemple, si toutefois il fallait rester dans le même code, pour la cellule H2 qui irait chercher la liste nommé "types" dans la feuille nommée "Infos"?