Friday 23 February 2018

How to delete hidden rows after filter in excel using VBA Code | How to delete hidden rows after filter in excel using VBA Macro

How to delete hidden rows after filter in excel using VBA Code | How to delete hidden rows after filter in excel using VBA Macro






VBA Code


Open Excel Sheet and Press Alt F11.
Go to insert menu and select new module.
in the new module paste the below code and save.

Sub deletehidden()
For lp = 256 To 1 Step -1
If Columns(lp).EntireColumn.Hidden = True Then Columns(lp).EntireColumn.Delete Else
Next
For lp = 65536 To 1 Step -1
If Rows(lp).EntireRow.Hidden = True Then Rows(lp).EntireRow.Delete Else
Next
End Sub

After saving the above code go the active excel sheet and select developer tab.
Click on Macros and select saved macro and click on run.

Now all the hidden rows in the filtered excel sheet will delete.




1 comment:

  1. You can quickly delete or remove or highlight hidden rows using this Dose for Excel add-in which provides also more than 100 functions to Excel:

    https://www.zbrainsoft.com/excel-delete-rows.html

    ReplyDelete