Modifier un Code VBA
#1
Débutant XLPages

Inscription: 27/03/2012

Messages: 9

Système d'exploitation:
PC
Version Excel utilisée:
2003
Posté le : 27-03-2012 11h55
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
On Error Resume Next










If Target.Value = "CHLORURE DE CINNAMOYLE" Or Target.Value = "CHLORHYDRATE DE DIMETHYLAMINE HOMOGENEISE" Or Target.Value = "HPBA-02 / HPBA-01" Or Target.Value = "LISTE DES FEUILLES DE FABRICATION D'HOMOTAURINE" _
Or Target.Value = "SECONDS JETS METFORMINE ET TRAITEMENT" Or Target.Value = "FABRICATION DES SECONDS JETS DE METFORMINE" Or Target.Value = "HHBA-02 / HHBA-01" _
Or Target.Value = "DESTRUCTION DES SECONDS JETS DE METFORMINE" Or Target.Value = "REPRISE DES SECONDS JETS DE METFORMINE BRUTE" Or Target.Value = "LISTE DES FEUILLES DE FABRICATION DU CHLORURE DE CINNAMOYLE" _
Or Target.Value = "METFORMINE BRUTE ETAPE II" Or Target.Value = "RETRAITEMENT DES BRUTS" Or Target.Value = "LISTE DES FEUILLES DE FABRICATION DE FABRICATION DE HHBA-02 / HHBA-01" Or Target.Value = "CHLORURE DE CINNAMOYLE SOLUTION TOLUENIQUE" _
Or Target.Value = "ETAPE II METFORMINE BRUTE 3ème CHAINE" Or Target.Value = "REPRISE DE METFORMINE STANDARD" Or Target.Value = "LISTE DES FEUILLES DE FABRICATION DE L'EMD387008/A1" _
Or Target.Value = "HOMOTAURINE" Or Target.Value = "EMD 387008/D1" Or Target.Value = "LISTE DES FEUILLES DE FABRICATION EMD 338064" Or Target.Value = "LISTE DES FEUILLES DE FABRICATION DU CRE 18428" _
Or Target.Value = "CHLORURE DE 4-CHLOROPHENOXYACETYLE OU 235-03" Or Target.Value = "ACIDE PARACHLOROPHENOXYACETYLE" Or Target.Value = "LISTE DES FEUILLES DE FABRICATION HPBA-02 / HPBA-01" _
Or Target.Value = "METFORMINE ETAPE IV CONDITIONNEMENT ETIQUETAGE" Or Target.Value = "METFORMINE ETAPE IV - CONDITIONNEMENT ETIQUETAGE 3ème CHAINE" Or Target.Value = "LISTE DES FEUILLES DE FABRICATION DE L'EMD 387008/D1" _
Or Target.Value = "METFORMINE ETAPE IV CONDITIONNEMENT ETIQUETAGE 25 KG" Or Target.Value = "METFORMINE, HCL 0,5 % STEARATE DE Mg MELANGE ET CONDITIONNEMEN" Or Target.Value = "LISTE DES FF DU CHLORURE DE 4-CHLOROPHENOXYACETYLE OU 235-03" _
Or Target.Value = "METFORMINE, HCl 0,5% STEARATE DE Mg MELANGE ET CONDITIONNEMENT" Or Target.Value = "METFORMINE, HCl 0,5% STEARATE DE Mg MELANGE ET CONDITIONNEMENT" Or Target.Value = "MET., HCl 0,5% STEARATE DE Mg MELANGE ET CONDITIONNEMENT" Or Target.Value = "METFORMINE +0,5% DE STEARATE DE Mg CONDITIONNEE EN BIG-BAG" _
Or Target.Value = "METFORMINE +0,5% DE STEARATE DE Mg CONDITIONNEE EN BIG-BAG" Or Target.Value = "METFORMINE +0,5% DE STEARATE DE Mg CONDITIONNEE EN BIG-BAG CHAINE NORD" _
Or Target.Value = "METFORMINE HCl BROYEE CONDITIONNEMENT ETIQUETAGE 3ème CHAINE" Or Target.Value = "METFORMINE HCl BROYEE CONDITIONNEMENT ETIQUETAGE 3è CHAINE" Or Target.Value = "LISTE DES FEUILLES DE FABRICATION DE L'IDROCILAMIDE" _
Or Target.Value = "IDROCILAMIDE" Or Target.Value = "LISTE DES FEUILLES DE FABRICATION DU MECLOFENOXATE" Or Target.Value = "FOSINOPRIL" Or Target.Value = "EMD 338064" _
Or Target.Value = "HHBA -2 / HHBA - 1" Or Target.Value = "CRE 18428" Or Target.Value = "EMD387008/A1" Or Target.Value = "METFORMINE - ETAPE III - RECRISTALLISATION/SECHAGE/BROYAGE" Or Target.Value = "RECRISTALLISATION DE METFORMINE ETAPE III - SECHAGE - BROYAGE" _
Or Target.Value = "MET. ETAPE III RECRISTALLISATION SECHAGE-BROYAGE 3ème CHAINE" Or Target.Value = "CHLORHYDRATE DE MECLOFENOXATE" Or Target.Value = "LISTE DES FEUILLES DE FABRICATION DU FOSINOPRIL" _
Or Target.Value = "PLAN D'OPERATION INTERNE" _
Then




MsgBox "Document disponible uniquement au format papier", vbInformation, "Note d'information"
End If




End Sub
 
Bonjour à tous,

Je travvaille depuis pas mal de temps sur un fichier excel d'index de dodument. En effet, cerrtains documents sont disponnible uniquement sous format papier. j'aimerais donc pouvoir rajouter des ligne dans cette VBA car je dois ajouter de nouveau document visible uniquement sous format papier :
Voici ci-dessous les codes, j'aimerais savoir comment le modifier pour pouvoir rajouter des lignes

Par avance merci
Bonne journée à tous

Hors Ligne
Rapport   Haut 

Re: Modifier un Code VBA
#2
Webmestre

Inscription: 18/05/2006
De Saône-et-Loire (71)

Messages: 1539

Système d'exploitation:
PC
Version Excel utilisée:
97, 2000, 2002, 2003, 2007, 2010, 2013, 2016 et 365
Posté le : 27-03-2012 19h11
Bonsoir dimdime, bienvenue sur XLpages.com

Pas sûr que ce soit vraiment une bonne idée de mettre ce type de code dans une procédure évènementielle de type SelectionChange() et pas sûr non plus d'avoir vraiment compris la question, mais je te proposerais de faire quelque chose comme ça :
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub

    Select Case Target.Value
   
    Case "CHLORURE DE CINNAMOYLE", "CHLORHYDRATE DE DIMETHYLAMINE HOMOGENEISE", "HPBA-02 / HPBA-01", _
            "LISTE DES FEUILLES DE FABRICATION D'HOMOTAURINE", "SECONDS JETS METFORMINE ET TRAITEMENT", _
            "REPRISE DES SECONDS JETS DE METFORMINE BRUTE", "Etc...", "Etc...", _
            "Etc..."
           
        MsgBox "Document disponible uniquement au format papier", vbInformation, "Note d'information"
    End Select
End Sub
 

Cordialement,


Didier_mDF
Image redimensionnée
Le Webmaster

La réponse vous satisfait ? Merci de revenir solder le sujet en [résolu], voir ce lien
Hors Ligne
Rapport   Haut 

Re: Modifier un Code VBA
#3
Débutant XLPages

Inscription: 27/03/2012

Messages: 9

Système d'exploitation:
PC
Version Excel utilisée:
2003
Posté le : 01-05-2012 19h00
merci pour votre aide :)
Hors Ligne
Rapport   Haut 


Vous pouvez voir les sujets.
Vous ne pouvez pas débuter de nouveaux sujets.
Vous ne pouvez pas répondre aux contributions.
Vous ne pouvez pas éditer vos contributions.
Vous ne pouvez pas effacez vos contributions.
Vous ne pouvez pas ajouter de nouveaux sondages.
Vous ne pouvez pas voter en sondage.
Vous ne pouvez pas attacher des fichiers à vos contributions.
Vous ne pouvez pas poster sans approbation.

[Recherche avancée]


Qui consulte actuellement ce sujet ?   1 Utilisateur(s) anonymes