Forum Discussion

logan383's avatar
logan383
Copper Contributor
Jan 08, 2025

How to remove hidden rows?

Hello,

I am working on a spreadsheet used for employee scheduling at my office. Recently, I hid over 200 rows in one sheet of the workbook. Today I attempted to remove these hidden rows following a process I discovered by Googling. (Using the "Inspect" feature to "Remove All" hidden rows and columns).

Unfortunately, this did not solve the problem. What it did was remove all the data in the sheet, including in the hidden rows, but the hidden rows are still there. So I restored my original workbook with the hidden rows and the data intact.

I am unclear of what to do at this point other than simply delete the sheet and start over. I don't think that hiding rows is supposed to be permanent and cannot be undone, but that has been my experience so far. 

2 Replies

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    Strange, Document Inspector removes all hidden rows and columns if only they are not within structured tables or PivotTables, and doesn't touch other data.

    Otherwise VBA of OfficeScript.

  • Are you considering VBA?

     

    Sub DeleteHiddenRows()
        Dim ws As Worksheet
        Dim rng As Range
        Dim row As Range
    
        Set ws = ActiveSheet
        Set rng = ws.UsedRange
    
        For Each row In rng.Rows
            If row.Hidden Then
                row.Delete
            End If
        Next row
    End Sub

     

Resources