Last active
March 4, 2018 11:23
-
-
Save ateneva/ae4953135b7cc7688dca6d36a7536557 to your computer and use it in GitHub Desktop.
Get rid of Excel unused range
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub GetRidOfUnUsedRange() | |
Dim Wks As Worksheet | |
Dim i As Integer | |
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
'written by Angelina Teneva, September 2016 | |
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
For Each Wks In ActiveWorkbook.Worksheets | |
If Wks.Index > 18 Then Wks.Activate | |
With ActiveSheet | |
'reaches the last populated cell and goes to the next row | |
Range("A2").End(xlDown).Offset(1, 0).Select | |
'uses the curently active cell and goes to the last one of the range | |
Range(ActiveCell, ActiveCell.SpecialCells(xlLastCell)).EntireRow.Delete | |
End With | |
Next | |
ActiveWorkbook.Save | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment