Pour une appli de planning, j'utilise une macro qui me permet de
n'afficher que les lignes correspondant à un nom choisi dans un
combobox, pour éditer un planning hebdo personnalisé. Pour balayer une
plage d'environ 170 lignes, cela prend 1 minute environ....Apparemment,
faire entirerow.hidden=true prend du temps.
Y aurait-il une manip plus efficace ????????
Voici le code:
Sub Tri_Liste()
[B1] = Now
Application.ScreenUpdating = False
Menu.Hide: Fonctions.Hide
Derniere_Ligne = Range("B65000").End(xlUp).Row
Range("B4").Select
For i = 1 To Derniere_Ligne
If InStr(ActiveCell.Value, Fonctions.Liste.Value) = 0 Then
If ActiveCell.Row Mod 7 = 3 Then GoTo Ligne_suivante
ActiveCell.EntireRow.Hidden = True
End If
Ligne_suivante:
ActiveCell.Offset(1, 0).Select
Next
Application.ScreenUpdating = True
Menu.Show False: Fonctions.Show False
[B2] = Now
End Sub
Merci d'avance pour vos avis z'éclairés !!
--
@+ thierryp
Plutôt que de faire une boucle, faire un filtre > Edition > Atteindre > cellules visibles > Masquer
AV
Ardus Petus
Voici une version optimisée:
'--------------------------------- Sub Tri_Liste() [B1] = Now Dim oCell As Range Dim str As String Application.ScreenUpdating = False Menu.Hide: Fonctions.Hide str = functions.List.Value For Each oCell In Range("B4", Cells(Rows.Count, "B").End(xlUp)) If InStr(oCell.Value, str) = 0 _ And oCell.Row Mod 7 <> 3 Then oCell.EntireRow.Hidden = True End If Next oCell Menu.Show False: Fonctions.Show False Application.ScreenUpdating = False [B2] = Now End Sub '--------------------------------
Cordialement, -- AP "ThierryP" a écrit dans le message de news:
Bonjour le forum,
Pour une appli de planning, j'utilise une macro qui me permet de n'afficher que les lignes correspondant à un nom choisi dans un combobox, pour éditer un planning hebdo personnalisé. Pour balayer une plage d'environ 170 lignes, cela prend 1 minute environ....Apparemment, faire entirerow.hidden=true prend du temps. Y aurait-il une manip plus efficace ????????
Voici le code:
Sub Tri_Liste() [B1] = Now Application.ScreenUpdating = False Menu.Hide: Fonctions.Hide Derniere_Ligne = Range("B65000").End(xlUp).Row Range("B4").Select For i = 1 To Derniere_Ligne If InStr(ActiveCell.Value, Fonctions.Liste.Value) = 0 Then If ActiveCell.Row Mod 7 = 3 Then GoTo Ligne_suivante ActiveCell.EntireRow.Hidden = True End If Ligne_suivante: ActiveCell.Offset(1, 0).Select Next Application.ScreenUpdating = True Menu.Show False: Fonctions.Show False [B2] = Now End Sub
Merci d'avance pour vos avis z'éclairés !! -- @+ thierryp
Voici une version optimisée:
'---------------------------------
Sub Tri_Liste()
[B1] = Now
Dim oCell As Range
Dim str As String
Application.ScreenUpdating = False
Menu.Hide: Fonctions.Hide
str = functions.List.Value
For Each oCell In Range("B4", Cells(Rows.Count, "B").End(xlUp))
If InStr(oCell.Value, str) = 0 _
And oCell.Row Mod 7 <> 3 Then
oCell.EntireRow.Hidden = True
End If
Next oCell
Menu.Show False: Fonctions.Show False
Application.ScreenUpdating = False
[B2] = Now
End Sub
'--------------------------------
Cordialement,
--
AP
"ThierryP" <thierryp_NO_SPAM@club-internet.fr> a écrit dans le message de
news:ufqdRggPGHA.1040@TK2MSFTNGP12.phx.gbl...
Bonjour le forum,
Pour une appli de planning, j'utilise une macro qui me permet de
n'afficher que les lignes correspondant à un nom choisi dans un
combobox, pour éditer un planning hebdo personnalisé. Pour balayer une
plage d'environ 170 lignes, cela prend 1 minute environ....Apparemment,
faire entirerow.hidden=true prend du temps.
Y aurait-il une manip plus efficace ????????
Voici le code:
Sub Tri_Liste()
[B1] = Now
Application.ScreenUpdating = False
Menu.Hide: Fonctions.Hide
Derniere_Ligne = Range("B65000").End(xlUp).Row
Range("B4").Select
For i = 1 To Derniere_Ligne
If InStr(ActiveCell.Value, Fonctions.Liste.Value) = 0 Then
If ActiveCell.Row Mod 7 = 3 Then GoTo Ligne_suivante
ActiveCell.EntireRow.Hidden = True
End If
Ligne_suivante:
ActiveCell.Offset(1, 0).Select
Next
Application.ScreenUpdating = True
Menu.Show False: Fonctions.Show False
[B2] = Now
End Sub
Merci d'avance pour vos avis z'éclairés !!
--
@+ thierryp
'--------------------------------- Sub Tri_Liste() [B1] = Now Dim oCell As Range Dim str As String Application.ScreenUpdating = False Menu.Hide: Fonctions.Hide str = functions.List.Value For Each oCell In Range("B4", Cells(Rows.Count, "B").End(xlUp)) If InStr(oCell.Value, str) = 0 _ And oCell.Row Mod 7 <> 3 Then oCell.EntireRow.Hidden = True End If Next oCell Menu.Show False: Fonctions.Show False Application.ScreenUpdating = False [B2] = Now End Sub '--------------------------------
Cordialement, -- AP "ThierryP" a écrit dans le message de news:
Bonjour le forum,
Pour une appli de planning, j'utilise une macro qui me permet de n'afficher que les lignes correspondant à un nom choisi dans un combobox, pour éditer un planning hebdo personnalisé. Pour balayer une plage d'environ 170 lignes, cela prend 1 minute environ....Apparemment, faire entirerow.hidden=true prend du temps. Y aurait-il une manip plus efficace ????????
Voici le code:
Sub Tri_Liste() [B1] = Now Application.ScreenUpdating = False Menu.Hide: Fonctions.Hide Derniere_Ligne = Range("B65000").End(xlUp).Row Range("B4").Select For i = 1 To Derniere_Ligne If InStr(ActiveCell.Value, Fonctions.Liste.Value) = 0 Then If ActiveCell.Row Mod 7 = 3 Then GoTo Ligne_suivante ActiveCell.EntireRow.Hidden = True End If Ligne_suivante: ActiveCell.Offset(1, 0).Select Next Application.ScreenUpdating = True Menu.Show False: Fonctions.Show False [B2] = Now End Sub
Merci d'avance pour vos avis z'éclairés !! -- @+ thierryp