View Single Post
 
Old 03-29-2025, 09:44 PM
MartinGM MartinGM is offline Windows 11 Office 2021
Competent Performer
 
Join Date: May 2023
Location: England
Posts: 108
MartinGM is on a distinguished road
Default

Quote:
Originally Posted by Logit View Post
The following will remove all 'empty' cells in your workbook. Test on a COPY OF YOUR WORKBOOK for safety reasons. Test for file size before then after running macro.

Code:
Sub LipoSuction()
'JBeaucaire (8/3/2009)
Dim LR As Long, LC As Long
Dim ws As Worksheet

For Each ws In Worksheets
    LR = ws.Range("A" & ws.Rows.Count).End(xlUp).Row + 1
    LC = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + 1

    'Clear everything below column A last cell and row 1 last cell
        ws.Range(ws.Cells(1, LC), ws.Cells(ws.Rows.Count, ws.Columns.Count)).Delete
        ws.Range(ws.Cells(LR, 1), ws.Cells(ws.Rows.Count, ws.Columns.Count)).Delete
Next ws

End Sub
Thanks, but that isn't addressing my issue. Your procedure clears cells outside the "used" area. My "problem" cell(s) is within the used area.

See my reply to PECOFLYER

Cheers

Martin
Reply With Quote