Nanogirl21
Active Member
- Joined
- Nov 19, 2013
- Messages
- 331
- Office Version
- 365
- Platform
- Windows
I am using the below code to delete all blank rows/columns and then fill all remaining blank cells or cells with value "(blank)" with a dash (-).
Is there anything that I can add to reset excels last cell after the extra columns and rows have been deleted?
In the past i've used ASAP Utilities, but I am trying to get away from add-ons.
Thank you
Is there anything that I can add to reset excels last cell after the extra columns and rows have been deleted?
In the past i've used ASAP Utilities, but I am trying to get away from add-ons.
Code:
Dim ws As Worksheet
For Each ws In Worksheets
On Error Resume Next
ActiveSheet.UsedRange
ws.Cells.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
ws.Cells.SpecialCells(xlCellTypeBlanks).EntireColumn.Delete
ws.Cells.SpecialCells(xlBlanks).Value = "-"
Cells.Replace What:="(blank)", Replacement:="-", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
On Error GoTo 0
Next ws
Thank you