VBA aide pour débutant
toto
-
toto -
toto -
Bonjour,
Bonjour,
J'ai une feuille Excel nommée « matchs joués » .j'ai une colonne(B) dans laquelle je choisi entre joué, ou non joué.
J'aimerai qu'avec un command bouton, les lignes dont la colonne B affiche « A joué » soient « repérées » afin que les valeurs des colonnes A et B de ces mêmes lignes soient envoyés dans une autre feuille Excel nommée « Match joués » dans les colonnes A et B dès la première ligne vide.
Je n'arrive pas transcrire cela en code....
Merci pour l' aide
Bonjour,
J'ai une feuille Excel nommée « matchs joués » .j'ai une colonne(B) dans laquelle je choisi entre joué, ou non joué.
J'aimerai qu'avec un command bouton, les lignes dont la colonne B affiche « A joué » soient « repérées » afin que les valeurs des colonnes A et B de ces mêmes lignes soient envoyés dans une autre feuille Excel nommée « Match joués » dans les colonnes A et B dès la première ligne vide.
Je n'arrive pas transcrire cela en code....
Merci pour l' aide
A voir également:
- VBA aide pour débutant
- Logiciel de programmation pour débutant - Guide
- Logiciel montage vidéo débutant - Guide
- Excel compter cellule couleur sans vba - Guide
- Vba attendre 1 seconde ✓ - Forum VB / VBA
- Apprendre le coran pour débutant (+ pdf) - Télécharger - Histoire & Religion
2 réponses
Bonjour,
Je ferai qqch comme ceci :
Sub envoi_a_feuil2()
Dim Rng As Range
Dim cel As Range
For Each cel In Feuil1.UsedRange.Offset(, 1).Resize(, 1)
If cel.Value = "Non Joué" Then
cel.EntireRow.Copy Feuil2.Cells(Feuil2.Range("A65536").End(xlUp).Row + 1, 1)
If Rng Is Nothing Then
Set Rng = cel.EntireRow
Else
Set Rng = Union(Rng, cel.EntireRow)
End If
End If
Next cel
Rng.Select
Selection.Delete Shift:=xlUp
End Sub
Ce n'est pas testé, donc je ne te garanti pas que cela marche.
Je ferai qqch comme ceci :
Sub envoi_a_feuil2()
Dim Rng As Range
Dim cel As Range
For Each cel In Feuil1.UsedRange.Offset(, 1).Resize(, 1)
If cel.Value = "Non Joué" Then
cel.EntireRow.Copy Feuil2.Cells(Feuil2.Range("A65536").End(xlUp).Row + 1, 1)
If Rng Is Nothing Then
Set Rng = cel.EntireRow
Else
Set Rng = Union(Rng, cel.EntireRow)
End If
End If
Next cel
Rng.Select
Selection.Delete Shift:=xlUp
End Sub
Ce n'est pas testé, donc je ne te garanti pas que cela marche.
Voici mon code pour le moment:
Cela ne marche pas...ni le tiens
Private Sub CommandButton4_Click()
With Sheets("JOUE")
Dim Lign As Long, DrLig As Long
DrLig = .Columns(2).Find("*", , , , xlByColumns, xlPrevious).Row
For Lign = 4 To DrLig
If UCase(.Cells(Lign, 6)) = "MATCH JOUES" Then
Sheets("A JOUE").Range("b65536").End(xlUp).Offset(1, 0) = .Cells(Lign, 6).Value
End If
Next Lign
End With
End Sub
Cela ne marche pas...ni le tiens
Private Sub CommandButton4_Click()
With Sheets("JOUE")
Dim Lign As Long, DrLig As Long
DrLig = .Columns(2).Find("*", , , , xlByColumns, xlPrevious).Row
For Lign = 4 To DrLig
If UCase(.Cells(Lign, 6)) = "MATCH JOUES" Then
Sheets("A JOUE").Range("b65536").End(xlUp).Offset(1, 0) = .Cells(Lign, 6).Value
End If
Next Lign
End With
End Sub