F
Fabien
Guest
Bonjour
Est ce que quelqu'un peut m'aider à mieux l'écrire, car quand je m'en sert mon fichier augmente en taille d'une facon importante
Merci
Sub SupprimeJoueur()
'déprotéger feuille
With ActiveSheet
.EnableSelection = xlNoRestrictions
.Unprotect Password:="Milou"
'positionner en fin de tableau
Cells.Find(What:="FinTab", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate
'sélection des deux lignes au dessus et efface
ActiveCell.Offset(-2, 0).Rows("1:2").EntireRow.Select
Selection.Delete Shift:=xlUp
'positionner en fin de tableau
Cells.Find(What:="FinTab", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate
'sélection de la zone pour refaire les bordures
ActiveCell.Offset(-2, 0).Range("C1:W1,Y1:Z1,AB1:AC1").Select
'Bordures
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
'positionner de la fin du demi tableau
Cells.Find(What:="FinDTab", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate
'sélection des deux lignes au dessus et efface
ActiveCell.Offset(-2, 0).Rows("1:2").EntireRow.Select
Selection.Delete Shift:=xlUp
'positionner de la fin du demi tableau
Cells.Find(What:="FinDTab", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate
'sélection de la zone pour refaire les bordures
ActiveCell.Offset(-2, 0).Range("C1:W1,Y1:Z1,AB1:AC1").Select
'Bordures
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
'positionner de la fin de tableau
Cells.Find(What:="FinTab", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate
'Sélection de toutes les lignes sauf les 4 qui suivent mon repère
ActiveCell.Offset(4, 0).Rows("1:65536").EntireRow.Select
Selection.EntireRow.Hidden = True
'Protège feuille
.EnableSelection = xlNoSelection
.Protect Password:="Milou", Contents:=True, UserInterfaceOnly:=True, Scenarios:=True
End With
End Sub
PS Rows("1:65536") fait planter ma macro, comment finou derniere au lieu 65536
Merci
Est ce que quelqu'un peut m'aider à mieux l'écrire, car quand je m'en sert mon fichier augmente en taille d'une facon importante
Merci
Sub SupprimeJoueur()
'déprotéger feuille
With ActiveSheet
.EnableSelection = xlNoRestrictions
.Unprotect Password:="Milou"
'positionner en fin de tableau
Cells.Find(What:="FinTab", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate
'sélection des deux lignes au dessus et efface
ActiveCell.Offset(-2, 0).Rows("1:2").EntireRow.Select
Selection.Delete Shift:=xlUp
'positionner en fin de tableau
Cells.Find(What:="FinTab", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate
'sélection de la zone pour refaire les bordures
ActiveCell.Offset(-2, 0).Range("C1:W1,Y1:Z1,AB1:AC1").Select
'Bordures
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
'positionner de la fin du demi tableau
Cells.Find(What:="FinDTab", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate
'sélection des deux lignes au dessus et efface
ActiveCell.Offset(-2, 0).Rows("1:2").EntireRow.Select
Selection.Delete Shift:=xlUp
'positionner de la fin du demi tableau
Cells.Find(What:="FinDTab", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate
'sélection de la zone pour refaire les bordures
ActiveCell.Offset(-2, 0).Range("C1:W1,Y1:Z1,AB1:AC1").Select
'Bordures
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
'positionner de la fin de tableau
Cells.Find(What:="FinTab", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate
'Sélection de toutes les lignes sauf les 4 qui suivent mon repère
ActiveCell.Offset(4, 0).Rows("1:65536").EntireRow.Select
Selection.EntireRow.Hidden = True
'Protège feuille
.EnableSelection = xlNoSelection
.Protect Password:="Milou", Contents:=True, UserInterfaceOnly:=True, Scenarios:=True
End With
End Sub
PS Rows("1:65536") fait planter ma macro, comment finou derniere au lieu 65536
Merci