1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| Sub NettoyerLignesFantômes()
Dim DL As Long, DC As Integer, Sh As Worksheet
Set Sh = Worksheets("tunover_export")
DL = DerLig(Sh) + 1
DC = DerLig(Sh) + 1
With Sh
.Range(.Cells(DL, "A"), .Cells(65536, "IV")).Delete xlUp
.Range(.Cells(1, DL), .Cells(DL, 256)).Delete xlUp
End With
End Sub
'--------------------------------
Function DerLig(Sh As Worksheet)
On Error Resume Next
DerLig = Sh.Cells.Find(What:="*", _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
On Error GoTo 0
End Function
'--------------------------------
Function DerCol(Sh As Worksheet)
On Error Resume Next
DerCol = Sh.Cells.Find(What:="*", _
LookIn:=xlFormulas, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
On Error GoTo 0
End Function |
Partager