esturges
New Member
- Joined
- Sep 15, 2003
- Messages
- 14
I have been given a worksheet (over 1600 rows) where detail rows were hidden so only totals show. I've now been asked to re-sort this worksheet and would like to delete the hidden rows as the detail has no relevance to the current use. I've changed all formulas to values so I can do this, but would like to automate the process as manual deletion is too time consuming. I came across the following macro, but it doesn't seem to work ... it appears to be working, but at the conclusion all hidden rows are still hidden and still part of the worksheet.
Any and all suggestions and/or corrections would be most appreciative as I'm "under the gun" (aren't we all?)!
TIA
P.S. I'm working in Excel 2000
Code:
Sub DeleteHiddenRows()
'
' Remove hidden rows from all sheets
'
For i = 1 To Worksheets.Count
If Worksheets(i).Visible Then
Worksheets(i).Select
ActiveCell.SpecialCells(xlLastCell).Select
k = ActiveCell.Row
For j = 1 To k
If Rows(j).Hidden Then
Rows(j).Hidden = False
Rows(j).Delete
End If
Next j
End If
Next i
If Worksheets(1).Visible Then Worksheets(1).Select
End Sub
Any and all suggestions and/or corrections would be most appreciative as I'm "under the gun" (aren't we all?)!
TIA
P.S. I'm working in Excel 2000