Question sur une feuille Excel
bfiguig
-
michel_m Messages postés 18903 Date d'inscription Statut Contributeur Dernière intervention -
michel_m Messages postés 18903 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour,
voila j'ai un probleme ou plutot une question sur une feuille excel:
je vais essayer d'expliquer le plus clairement possible sinon je peux envoyer le fichier excel à celui qui veut le regarder de plus pre et merci d'avance.
en fait, j'ai une liste deroulante qui contient deux elements (client et fournisseur)
quand je selectionne client je doit afficher des données sur la meme feuille dans mon exemple j'affiche 7 lignes de deux colonnes. les données sont affichées sur (A11,A17) et (B11,B17).
quand je selectionne fournisseur j'affiche sur le meme endroit 5 lignes de deux colonnes. les données sont affichées sur (A11,A15) et (B11,B15)
quand je selectionne fournisseur je fais en sorte de supprimer les ligne 16 et 17
mon probleme c'est que quand je suis dans le cas de fournisseur et que j'essaye d'ecrire sur les cellules A16 ou A17 ou B16 ou B17 ca s'efface.
voila le code que j'utilise :
Private Sub Worksheet_Change(ByVal Target As Range)
If Target <> "" And Cells(5, 2) = "CLIENT" Then
If Cells(11, 1) <> "CLIENT1" Then
If Not IsEmpty(Cells(11, 1)) Then
Cells(11, 1) = "CLIENT1"
End If
End If
If Cells(12, 1) <> "CLIENT2" Then
If Not IsEmpty(Cells(12, 1)) Then
Cells(12, 1) = "CLIENT2"
End If
End If
If Cells(13, 1) <> "CLIENT3" Then
If Not IsEmpty(Cells(13, 1)) Then
Cells(13, 1) = "CLIENT3"
End If
End If
If Cells(14, 1) <> "CLIENT4" Then
If Not IsEmpty(Cells(14, 1)) Then
Cells(14, 1) = "CLIENT4"
End If
End If
If Cells(15, 1) <> "CLIENT5" Then
If Not IsEmpty(Cells(15, 1)) Then
Cells(15, 1) = "CLIENT5"
End If
End If
'If Cells(16, 1) <> "CLIENT6" Then
If IsEmpty(Cells(16, 1)) Then
Cells(16, 1) = "CLIENT6"
End If
'End If
'If Cells(17, 1) <> "CLIENT7" Then
If IsEmpty(Cells(17, 1)) Then
Cells(17, 1) = "CLIENT7"
End If
'End If
If Cells(11, 2) <> "200" Then
If Not IsEmpty(Cells(11, 2)) Then
Cells(11, 2) = "200"
End If
End If
If Cells(12, 2) <> "300" Then
If Not IsEmpty(Cells(12, 2)) Then
Cells(12, 2) = "300"
End If
End If
If Cells(13, 2) <> "400" Then
If Not IsEmpty(Cells(13, 2)) Then
Cells(13, 2) = "400"
End If
End If
If Cells(14, 2) <> "500" Then
If Not IsEmpty(Cells(14, 2)) Then
Cells(14, 2) = "500"
End If
End If
If Cells(15, 2) <> "600" Then
If Not IsEmpty(Cells(15, 2)) Then
Cells(15, 2) = "600"
End If
End If
'If Cells(16, 2) <> "700€" Then
If IsEmpty(Cells(16, 2)) Then
Cells(16, 2) = "700"
End If
'End If
'If Cells(17, 2) <> "800€" Then
If IsEmpty(Cells(17, 2)) Then
Cells(17, 2) = "800"
End If
'End If
End If
If Target <> "" And Cells(5, 2) = "FOURNISSEUR" Then
If Cells(11, 1) <> "FOURNISSEUR1" Then
If Not IsEmpty(Cells(11, 1)) Then
Cells(11, 1) = "FOURNISSEUR1"
End If
End If
If Cells(12, 1) <> "FOURNISSEUR2" Then
If Not IsEmpty(Cells(12, 1)) Then
Cells(12, 1) = "FOURNISSEUR2"
End If
End If
If Cells(13, 1) <> "FOURNISSEUR3" Then
If Not IsEmpty(Cells(13, 1)) Then
Cells(13, 1) = "FOURNISSEUR3"
End If
End If
If Cells(14, 1) <> "FOURNISSEUR4" Then
If Not IsEmpty(Cells(14, 1)) Then
Cells(14, 1) = "FOURNISSEUR4"
End If
End If
If Cells(15, 1) <> "FOURNISSEUR5" Then
If Not IsEmpty(Cells(15, 1)) Then
Cells(15, 1) = "FOURNISSEUR5"
End If
End If
If Not IsEmpty(Cells(16, 1)) Then
Cells(16, 1) = ""
End If
If Not IsEmpty(Cells(17, 1)) Then
Cells(17, 1) = ""
End If
If Cells(11, 2) <> "FACTURE1" Then
If Not IsEmpty(Cells(11, 2)) Then
Cells(11, 2) = "FACTURE1"
End If
End If
If Cells(12, 2) <> "FACTURE2" Then
If Not IsEmpty(Cells(12, 2)) Then
Cells(12, 2) = "FACTURE2"
End If
End If
If Cells(13, 2) <> "FACTURE3" Then
If Not IsEmpty(Cells(13, 2)) Then
Cells(13, 2) = "FACTURE3"
End If
End If
If Cells(14, 2) <> "FACTURE4" Then
If Not IsEmpty(Cells(14, 2)) Then
Cells(14, 2) = "FACTURE4"
End If
End If
If Cells(15, 2) <> "FACTURE5" Then
If Not IsEmpty(Cells(15, 2)) Then
Cells(15, 2) = "FACTURE5"
End If
End If
If Not IsEmpty(Cells(16, 2)) Then
Cells(16, 2) = ""
End If
If Not IsEmpty(Cells(17, 2)) Then
Cells(17, 2) = ""
End If
End If
End Sub
merci de m'aider
cordialement
voila j'ai un probleme ou plutot une question sur une feuille excel:
je vais essayer d'expliquer le plus clairement possible sinon je peux envoyer le fichier excel à celui qui veut le regarder de plus pre et merci d'avance.
en fait, j'ai une liste deroulante qui contient deux elements (client et fournisseur)
quand je selectionne client je doit afficher des données sur la meme feuille dans mon exemple j'affiche 7 lignes de deux colonnes. les données sont affichées sur (A11,A17) et (B11,B17).
quand je selectionne fournisseur j'affiche sur le meme endroit 5 lignes de deux colonnes. les données sont affichées sur (A11,A15) et (B11,B15)
quand je selectionne fournisseur je fais en sorte de supprimer les ligne 16 et 17
mon probleme c'est que quand je suis dans le cas de fournisseur et que j'essaye d'ecrire sur les cellules A16 ou A17 ou B16 ou B17 ca s'efface.
voila le code que j'utilise :
Private Sub Worksheet_Change(ByVal Target As Range)
If Target <> "" And Cells(5, 2) = "CLIENT" Then
If Cells(11, 1) <> "CLIENT1" Then
If Not IsEmpty(Cells(11, 1)) Then
Cells(11, 1) = "CLIENT1"
End If
End If
If Cells(12, 1) <> "CLIENT2" Then
If Not IsEmpty(Cells(12, 1)) Then
Cells(12, 1) = "CLIENT2"
End If
End If
If Cells(13, 1) <> "CLIENT3" Then
If Not IsEmpty(Cells(13, 1)) Then
Cells(13, 1) = "CLIENT3"
End If
End If
If Cells(14, 1) <> "CLIENT4" Then
If Not IsEmpty(Cells(14, 1)) Then
Cells(14, 1) = "CLIENT4"
End If
End If
If Cells(15, 1) <> "CLIENT5" Then
If Not IsEmpty(Cells(15, 1)) Then
Cells(15, 1) = "CLIENT5"
End If
End If
'If Cells(16, 1) <> "CLIENT6" Then
If IsEmpty(Cells(16, 1)) Then
Cells(16, 1) = "CLIENT6"
End If
'End If
'If Cells(17, 1) <> "CLIENT7" Then
If IsEmpty(Cells(17, 1)) Then
Cells(17, 1) = "CLIENT7"
End If
'End If
If Cells(11, 2) <> "200" Then
If Not IsEmpty(Cells(11, 2)) Then
Cells(11, 2) = "200"
End If
End If
If Cells(12, 2) <> "300" Then
If Not IsEmpty(Cells(12, 2)) Then
Cells(12, 2) = "300"
End If
End If
If Cells(13, 2) <> "400" Then
If Not IsEmpty(Cells(13, 2)) Then
Cells(13, 2) = "400"
End If
End If
If Cells(14, 2) <> "500" Then
If Not IsEmpty(Cells(14, 2)) Then
Cells(14, 2) = "500"
End If
End If
If Cells(15, 2) <> "600" Then
If Not IsEmpty(Cells(15, 2)) Then
Cells(15, 2) = "600"
End If
End If
'If Cells(16, 2) <> "700€" Then
If IsEmpty(Cells(16, 2)) Then
Cells(16, 2) = "700"
End If
'End If
'If Cells(17, 2) <> "800€" Then
If IsEmpty(Cells(17, 2)) Then
Cells(17, 2) = "800"
End If
'End If
End If
If Target <> "" And Cells(5, 2) = "FOURNISSEUR" Then
If Cells(11, 1) <> "FOURNISSEUR1" Then
If Not IsEmpty(Cells(11, 1)) Then
Cells(11, 1) = "FOURNISSEUR1"
End If
End If
If Cells(12, 1) <> "FOURNISSEUR2" Then
If Not IsEmpty(Cells(12, 1)) Then
Cells(12, 1) = "FOURNISSEUR2"
End If
End If
If Cells(13, 1) <> "FOURNISSEUR3" Then
If Not IsEmpty(Cells(13, 1)) Then
Cells(13, 1) = "FOURNISSEUR3"
End If
End If
If Cells(14, 1) <> "FOURNISSEUR4" Then
If Not IsEmpty(Cells(14, 1)) Then
Cells(14, 1) = "FOURNISSEUR4"
End If
End If
If Cells(15, 1) <> "FOURNISSEUR5" Then
If Not IsEmpty(Cells(15, 1)) Then
Cells(15, 1) = "FOURNISSEUR5"
End If
End If
If Not IsEmpty(Cells(16, 1)) Then
Cells(16, 1) = ""
End If
If Not IsEmpty(Cells(17, 1)) Then
Cells(17, 1) = ""
End If
If Cells(11, 2) <> "FACTURE1" Then
If Not IsEmpty(Cells(11, 2)) Then
Cells(11, 2) = "FACTURE1"
End If
End If
If Cells(12, 2) <> "FACTURE2" Then
If Not IsEmpty(Cells(12, 2)) Then
Cells(12, 2) = "FACTURE2"
End If
End If
If Cells(13, 2) <> "FACTURE3" Then
If Not IsEmpty(Cells(13, 2)) Then
Cells(13, 2) = "FACTURE3"
End If
End If
If Cells(14, 2) <> "FACTURE4" Then
If Not IsEmpty(Cells(14, 2)) Then
Cells(14, 2) = "FACTURE4"
End If
End If
If Cells(15, 2) <> "FACTURE5" Then
If Not IsEmpty(Cells(15, 2)) Then
Cells(15, 2) = "FACTURE5"
End If
End If
If Not IsEmpty(Cells(16, 2)) Then
Cells(16, 2) = ""
End If
If Not IsEmpty(Cells(17, 2)) Then
Cells(17, 2) = ""
End If
End If
End Sub
merci de m'aider
cordialement
A voir également:
- Question sur une feuille Excel
- Liste déroulante excel - Guide
- Feuille de pointage excel - Télécharger - Tableur
- Déplacer une colonne excel - Guide
- Word et excel gratuit - Guide
- Comment trier par ordre alphabétique sur excel - Guide
4 réponses
Bonjour, salut michel
Ton code, je le considère comme illisible, il n'est pas indenté alors qu'il existe des balises pour ne pas changer la mise en forme des codes
Personnellement, je veux bien faire un effort sur 5 ou 10 lignes, mais là je n'ai même pas compté
De plus tu es pressé ?? alors qu'il n'y a aucun effort de présentation ??
comme le dit michel, nous sommes de bénévoles et nous répondons aux questions lorsque :
1 - nous sommes disponibles,
2 - elles sont lisibles
3 - Qu'un effort soit fait par le demandeur
je ne pense pas que cela soit éxagéré étant donné que son portefeuille reste plein. Tu n'es pas un client, tu es un demandeur.
Ton code, je le considère comme illisible, il n'est pas indenté alors qu'il existe des balises pour ne pas changer la mise en forme des codes
Personnellement, je veux bien faire un effort sur 5 ou 10 lignes, mais là je n'ai même pas compté
De plus tu es pressé ?? alors qu'il n'y a aucun effort de présentation ??
comme le dit michel, nous sommes de bénévoles et nous répondons aux questions lorsque :
1 - nous sommes disponibles,
2 - elles sont lisibles
3 - Qu'un effort soit fait par le demandeur
je ne pense pas que cela soit éxagéré étant donné que son portefeuille reste plein. Tu n'es pas un client, tu es un demandeur.
Re-bonjour à tous,
j'attend toujours quelqu'un qui pourras jeter un coup d'oeuil sur mon probleme
merci d'avance
j'attend toujours quelqu'un qui pourras jeter un coup d'oeuil sur mon probleme
merci d'avance
vraiment je suis desolé, et mon attention etait tout simplement rappeler mon probleme sans arrieres pensées
et je sais tres bien que c'est des benevoles qui repondent et pour l'occasion je remerci toute personne qui participe à ce forum pour l'enrechir et pour aider les autres sans retour.
je repete ne le prenez pas mal et desolé encore une fois
je m'excuse de toutes ces lignes de codes c'est vrai c'est beaucoup donc pour cela je vous envois un lien ou trouver mon fichier excel :
https://www.excel-pratique.com/~files/doc/tgP3jtest.xls
en fait pour tester essaye de selectionner client et tu vas voir afficher 7 lignes ensuite tu selectionne fournisseur et tu vas voir 5 lignes qui s'affichent
mon probleme c'est que des que j'ecris sur les lignes A16 ou A17 ou B16 ou B17 le contenu s'efface
merci d'avance
amicalement
en fait ce lien ne peut pas fonctionner, il faut etre dans le site concerne qui est le suivant :
https://forum.excel-pratique.com/viewtopic.php?t=8667
merci