voila je viens d'essayer ceci pour copier toutes les lignes de feuil1 qui contiennent le mot "obligation
mais j'ai une erreur
quelqu'un peu t-il m'aider? merci
Sub toto()
[cpp]
Dim MotCherche, L, C, InL, InC, OutL
Dim Origine, Destination
Set Origine = Workbooks(1).Sheets(1)
Set Destination = Workbooks(1).Sheets(2)
MotCherche = "obligation"
InL = Origine.ActiveCell.SpecialCells(xlCellTypeLastCell).Row
InC = Origine.ActiveCell.SpecialCells(xlCellTypeLastCell).Column
OutL = Destination.ActiveCell.SpecialCells(xlCellTypeLastCell).Row
For L = 1 To InL
If Origine.Cells(L, 1).Value = MotCherché Then
For C = 1 To InC
Destination.Cells(OutL, C).Value = Origine.Cells(L, C).Value
Next
OutL = OutL + 1
End If
Next
End Sub[/cpp]
merci
mais j'ai une erreur
quelqu'un peu t-il m'aider? merci
Sub toto()
[cpp]
Dim MotCherche, L, C, InL, InC, OutL
Dim Origine, Destination
Set Origine = Workbooks(1).Sheets(1)
Set Destination = Workbooks(1).Sheets(2)
MotCherche = "obligation"
InL = Origine.ActiveCell.SpecialCells(xlCellTypeLastCell).Row
InC = Origine.ActiveCell.SpecialCells(xlCellTypeLastCell).Column
OutL = Destination.ActiveCell.SpecialCells(xlCellTypeLastCell).Row
For L = 1 To InL
If Origine.Cells(L, 1).Value = MotCherché Then
For C = 1 To InC
Destination.Cells(OutL, C).Value = Origine.Cells(L, C).Value
Next
OutL = OutL + 1
End If
Next
End Sub[/cpp]
merci