Voici une macro qui =E9limine les rang=E9es si la valeur en colonne B
n'est pas la m=EAme que celle en C1:
Sub Eliminer()
With ActiveSheet
Dim Lastrow As Integer, i As Integer
Lastrow =3D Range("B65000").End(xlUp).Row
For i =3D Lastrow To 2 Step -1
If Cells(i, 2).Row =3D 2 Then Exit Sub
If Cells(i, 2).Value <> Range("C1").Value Then Cells(i,
2).EntireRow.Delete
Next
End With
End Sub
Sauf que =E7a prend une vie..... j'ai essay=E9 avec le filtre.... mais
voici:
Sub EliminerOng()
With Worksheets("Ongoing")
Application.ScreenUpdating =3D False
With .Range("B1:B50000")
.AutoFilter Field:=3D1, Criteria1:=3D"<>Range("C1")" '<------ =C7a
marche pas ici !!!!!
.Range("_FilterDatabase").Offset(1).SpecialCells(xlCellTypeVisible)
_
.EntireRow.Delete (xlUp)
.AutoFilter
End With
End With
End Sub
Quelqu'un saurait comment filtrer en disant que le crit=E8re 1 est
"diff=E9rent de ce qui est =E9crit en C1, alors on =E9limine la ligne"
Sub sup_diff() [G:G].Insert Shift:=xlToRight [G2].Formula = "²<>C2" [A1:E1000].AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=[G1:G2] If MsgBox("Etes vous sûr?", vbYesNo) = vbYes Then Range("_FilterDataBase").Offset(1, 0).Resize(Range("_FilterDataBase"). _ Rows.Count - 1).SpecialCells(xlCellTypeVisible).Delete Shift:=xlUp Else MsgBox "Annulé" End If ActiveSheet.ShowAllData [G:G].Delete Shift:=xlToLeft End Sub
JB
On 11 sep, 21:27, Denys wrote:
Bonjour à tous,
Voici une macro qui élimine les rangées si la valeur en colonne B n'est pas la même que celle en C1:
Sub Eliminer() With ActiveSheet Dim Lastrow As Integer, i As Integer Lastrow = Range("B65000").End(xlUp).Row For i = Lastrow To 2 Step -1 If Cells(i, 2).Row = 2 Then Exit Sub If Cells(i, 2).Value <> Range("C1").Value Then Cells(i, 2).EntireRow.Delete Next End With End Sub
Sauf que ça prend une vie..... j'ai essayé avec le filtre.... mais voici:
Sub EliminerOng() With Worksheets("Ongoing") Application.ScreenUpdating = False With .Range("B1:B50000") .AutoFilter Field:=1, Criteria1:="<>Range("C1")" '<------ Ça marche pas ici !!!!! .Range("_FilterDatabase").Offset(1).SpecialCells(xlCellTypeVisibl e) _ .EntireRow.Delete (xlUp) .AutoFilter End With End With End Sub
Quelqu'un saurait comment filtrer en disant que le critère 1 est "différent de ce qui est écrit en C1, alors on élimine la ligne"
Merci pour votre temps
Denys
Bonsoir,
http://cjoint.com/?jlvLKDQ1I8
Sub sup_diff()
[G:G].Insert Shift:=xlToRight
[G2].Formula = "=B2<>C2"
[A1:E1000].AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:=[G1:G2]
If MsgBox("Etes vous sûr?", vbYesNo) = vbYes Then
Range("_FilterDataBase").Offset(1,
0).Resize(Range("_FilterDataBase"). _
Rows.Count - 1).SpecialCells(xlCellTypeVisible).Delete
Shift:=xlUp
Else
MsgBox "Annulé"
End If
ActiveSheet.ShowAllData
[G:G].Delete Shift:=xlToLeft
End Sub
JB
On 11 sep, 21:27, Denys <denys.perrea...@rbc.com> wrote:
Bonjour à tous,
Voici une macro qui élimine les rangées si la valeur en colonne B
n'est pas la même que celle en C1:
Sub Eliminer()
With ActiveSheet
Dim Lastrow As Integer, i As Integer
Lastrow = Range("B65000").End(xlUp).Row
For i = Lastrow To 2 Step -1
If Cells(i, 2).Row = 2 Then Exit Sub
If Cells(i, 2).Value <> Range("C1").Value Then Cells(i,
2).EntireRow.Delete
Next
End With
End Sub
Sauf que ça prend une vie..... j'ai essayé avec le filtre.... mais
voici:
Sub EliminerOng()
With Worksheets("Ongoing")
Application.ScreenUpdating = False
With .Range("B1:B50000")
.AutoFilter Field:=1, Criteria1:="<>Range("C1")" '<------ Ça
marche pas ici !!!!!
.Range("_FilterDatabase").Offset(1).SpecialCells(xlCellTypeVisibl e)
_
.EntireRow.Delete (xlUp)
.AutoFilter
End With
End With
End Sub
Quelqu'un saurait comment filtrer en disant que le critère 1 est
"différent de ce qui est écrit en C1, alors on élimine la ligne"
Sub sup_diff() [G:G].Insert Shift:=xlToRight [G2].Formula = "²<>C2" [A1:E1000].AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=[G1:G2] If MsgBox("Etes vous sûr?", vbYesNo) = vbYes Then Range("_FilterDataBase").Offset(1, 0).Resize(Range("_FilterDataBase"). _ Rows.Count - 1).SpecialCells(xlCellTypeVisible).Delete Shift:=xlUp Else MsgBox "Annulé" End If ActiveSheet.ShowAllData [G:G].Delete Shift:=xlToLeft End Sub
JB
On 11 sep, 21:27, Denys wrote:
Bonjour à tous,
Voici une macro qui élimine les rangées si la valeur en colonne B n'est pas la même que celle en C1:
Sub Eliminer() With ActiveSheet Dim Lastrow As Integer, i As Integer Lastrow = Range("B65000").End(xlUp).Row For i = Lastrow To 2 Step -1 If Cells(i, 2).Row = 2 Then Exit Sub If Cells(i, 2).Value <> Range("C1").Value Then Cells(i, 2).EntireRow.Delete Next End With End Sub
Sauf que ça prend une vie..... j'ai essayé avec le filtre.... mais voici:
Sub EliminerOng() With Worksheets("Ongoing") Application.ScreenUpdating = False With .Range("B1:B50000") .AutoFilter Field:=1, Criteria1:="<>Range("C1")" '<------ Ça marche pas ici !!!!! .Range("_FilterDatabase").Offset(1).SpecialCells(xlCellTypeVisibl e) _ .EntireRow.Delete (xlUp) .AutoFilter End With End With End Sub
Quelqu'un saurait comment filtrer en disant que le critère 1 est "différent de ce qui est écrit en C1, alors on élimine la ligne"
Merci pour votre temps
Denys
Philippe.R
Bonjour Denys, Et si tu essayais d'ajouter Application.ScreenUpdating = False en début de la 1ère macro + une restriction sur le recalcul
Sub Eliminer() Application.ScreenUpdating = False Application.Calculation = xlCalculationManual With ActiveSheet Dim Lastrow As Integer, i As Integer Lastrow = Range("B65000").End(xlUp).Row For i = Lastrow To 2 Step -1 If Cells(i, 2).Row = 2 Then Exit Sub If Cells(i, 2).Value <> Range("C1").Value Then Cells(i,2).EntireRow.Delete Next End With Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True End Sub
en remettant tout en standard à la fin -- Avec plaisir Philippe.R "Denys" a écrit dans le message de news: Bonjour à tous,
Voici une macro qui élimine les rangées si la valeur en colonne B n'est pas la même que celle en C1:
Sub Eliminer() With ActiveSheet Dim Lastrow As Integer, i As Integer Lastrow = Range("B65000").End(xlUp).Row For i = Lastrow To 2 Step -1 If Cells(i, 2).Row = 2 Then Exit Sub If Cells(i, 2).Value <> Range("C1").Value Then Cells(i, 2).EntireRow.Delete Next End With End Sub
Sauf que ça prend une vie..... j'ai essayé avec le filtre.... mais voici:
Sub EliminerOng() With Worksheets("Ongoing") Application.ScreenUpdating = False With .Range("B1:B50000") .AutoFilter Field:=1, Criteria1:="<>Range("C1")" '<------ Ça marche pas ici !!!!! .Range("_FilterDatabase").Offset(1).SpecialCells(xlCellTypeVisible) _ .EntireRow.Delete (xlUp) .AutoFilter End With End With End Sub
Quelqu'un saurait comment filtrer en disant que le critère 1 est "différent de ce qui est écrit en C1, alors on élimine la ligne"
Merci pour votre temps
Denys
Bonjour Denys,
Et si tu essayais d'ajouter Application.ScreenUpdating = False en début de
la 1ère macro + une restriction sur le recalcul
Sub Eliminer()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
With ActiveSheet
Dim Lastrow As Integer, i As Integer
Lastrow = Range("B65000").End(xlUp).Row
For i = Lastrow To 2 Step -1
If Cells(i, 2).Row = 2 Then Exit Sub
If Cells(i, 2).Value <> Range("C1").Value Then
Cells(i,2).EntireRow.Delete
Next
End With
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
en remettant tout en standard à la fin
--
Avec plaisir
Philippe.R
"Denys" <denys.perreault@rbc.com> a écrit dans le message de
news:1189538831.537018.49500@v23g2000prn.googlegroups.com...
Bonjour à tous,
Voici une macro qui élimine les rangées si la valeur en colonne B
n'est pas la même que celle en C1:
Sub Eliminer()
With ActiveSheet
Dim Lastrow As Integer, i As Integer
Lastrow = Range("B65000").End(xlUp).Row
For i = Lastrow To 2 Step -1
If Cells(i, 2).Row = 2 Then Exit Sub
If Cells(i, 2).Value <> Range("C1").Value Then Cells(i,
2).EntireRow.Delete
Next
End With
End Sub
Sauf que ça prend une vie..... j'ai essayé avec le filtre.... mais
voici:
Sub EliminerOng()
With Worksheets("Ongoing")
Application.ScreenUpdating = False
With .Range("B1:B50000")
.AutoFilter Field:=1, Criteria1:="<>Range("C1")" '<------ Ça
marche pas ici !!!!!
.Range("_FilterDatabase").Offset(1).SpecialCells(xlCellTypeVisible)
_
.EntireRow.Delete (xlUp)
.AutoFilter
End With
End With
End Sub
Quelqu'un saurait comment filtrer en disant que le critère 1 est
"différent de ce qui est écrit en C1, alors on élimine la ligne"
Bonjour Denys, Et si tu essayais d'ajouter Application.ScreenUpdating = False en début de la 1ère macro + une restriction sur le recalcul
Sub Eliminer() Application.ScreenUpdating = False Application.Calculation = xlCalculationManual With ActiveSheet Dim Lastrow As Integer, i As Integer Lastrow = Range("B65000").End(xlUp).Row For i = Lastrow To 2 Step -1 If Cells(i, 2).Row = 2 Then Exit Sub If Cells(i, 2).Value <> Range("C1").Value Then Cells(i,2).EntireRow.Delete Next End With Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True End Sub
en remettant tout en standard à la fin -- Avec plaisir Philippe.R "Denys" a écrit dans le message de news: Bonjour à tous,
Voici une macro qui élimine les rangées si la valeur en colonne B n'est pas la même que celle en C1:
Sub Eliminer() With ActiveSheet Dim Lastrow As Integer, i As Integer Lastrow = Range("B65000").End(xlUp).Row For i = Lastrow To 2 Step -1 If Cells(i, 2).Row = 2 Then Exit Sub If Cells(i, 2).Value <> Range("C1").Value Then Cells(i, 2).EntireRow.Delete Next End With End Sub
Sauf que ça prend une vie..... j'ai essayé avec le filtre.... mais voici:
Sub EliminerOng() With Worksheets("Ongoing") Application.ScreenUpdating = False With .Range("B1:B50000") .AutoFilter Field:=1, Criteria1:="<>Range("C1")" '<------ Ça marche pas ici !!!!! .Range("_FilterDatabase").Offset(1).SpecialCells(xlCellTypeVisible) _ .EntireRow.Delete (xlUp) .AutoFilter End With End With End Sub
Quelqu'un saurait comment filtrer en disant que le critère 1 est "différent de ce qui est écrit en C1, alors on élimine la ligne"
Merci pour votre temps
Denys
Denys
Bonjour Philippe et JB,
Merci beaucoup, ça fonctionne au quart de tour !!!
Bonne soirée
Denys
Bonjour Philippe et JB,
Merci beaucoup, ça fonctionne au quart de tour !!!