VBA Excel
Tarik
-
Frenchie83 Messages postés 2254 Statut Membre -
Frenchie83 Messages postés 2254 Statut Membre -
Bonjour,
J'ai fait une macro qui va chercher des données précises dans un autre fichiers et qui copie la ligne entière.
Ma macro est censée rechercher et copier 3 lignes de données précises dans un autre fichier cependant une fois la macro lancée elle n'applique ce programme qu'a une seule "hypothèse" sur les 3 possible.
Cela se produit aussi bien avec l'instruction IF qu'avec SELECT CASE :
Avec IF
If Range("A" & numeroligne).Value = hypothese1 Then
Range("A" & numeroligne).EntireRow.Copy
Windows("EXPLOIT DATA.xlsm").Activate
Range("A10").PasteSpecial xlPasteAll
End If
If Range("A" & numeroligne).Value = hypothese2 Then
Range("A" & numeroligne).EntireRow.Copy
Windows("EXPLOIT DATA.xlsm").Activate
Range("A11").PasteSpecial xlPasteAll
End If
If Range("A" & numeroligne).Value = hypothese3 Then
Range("A" & numeroligne).EntireRow.Copy
Windows("EXPLOIT DATA.xlsm").Activate
Range("A12").PasteSpecial xlPasteAll
__________________________________________________________
Avec Select Case
Select Case Range("A" & numeroligne)
Case hypothese1
Range("A" & numeroligne).EntireRow.Copy
Sheets("Feuil1").Activate
Range("A10").PasteSpecial xlPasteAll
Case hypothese2
Range("A" & numeroligne).EntireRow.Copy
Sheets("Feuil1").Activate
Range("A11").PasteSpecial xlPasteAll
Case hypothese3
Range("A" & numeroligne).EntireRow.Copy
Sheets("Feuil1").Activate
Range("A12").PasteSpecial xlPasteAll
End Select
End Sub
________________________________________________________
Merci pour votre aide.
Tarik.
J'ai fait une macro qui va chercher des données précises dans un autre fichiers et qui copie la ligne entière.
Ma macro est censée rechercher et copier 3 lignes de données précises dans un autre fichier cependant une fois la macro lancée elle n'applique ce programme qu'a une seule "hypothèse" sur les 3 possible.
Cela se produit aussi bien avec l'instruction IF qu'avec SELECT CASE :
Avec IF
If Range("A" & numeroligne).Value = hypothese1 Then
Range("A" & numeroligne).EntireRow.Copy
Windows("EXPLOIT DATA.xlsm").Activate
Range("A10").PasteSpecial xlPasteAll
End If
If Range("A" & numeroligne).Value = hypothese2 Then
Range("A" & numeroligne).EntireRow.Copy
Windows("EXPLOIT DATA.xlsm").Activate
Range("A11").PasteSpecial xlPasteAll
End If
If Range("A" & numeroligne).Value = hypothese3 Then
Range("A" & numeroligne).EntireRow.Copy
Windows("EXPLOIT DATA.xlsm").Activate
Range("A12").PasteSpecial xlPasteAll
__________________________________________________________
Avec Select Case
Select Case Range("A" & numeroligne)
Case hypothese1
Range("A" & numeroligne).EntireRow.Copy
Sheets("Feuil1").Activate
Range("A10").PasteSpecial xlPasteAll
Case hypothese2
Range("A" & numeroligne).EntireRow.Copy
Sheets("Feuil1").Activate
Range("A11").PasteSpecial xlPasteAll
Case hypothese3
Range("A" & numeroligne).EntireRow.Copy
Sheets("Feuil1").Activate
Range("A12").PasteSpecial xlPasteAll
End Select
End Sub
________________________________________________________
Merci pour votre aide.
Tarik.
A voir également:
- VBA Excel
- Liste déroulante excel - Guide
- Word et excel gratuit - Guide
- Si ou excel - Guide
- Déplacer colonne excel - Guide
- Excel compter cellule couleur sans vba - Guide