Pages

Friday, 9 July 2021

VBA Code to delete hidden rows in Excel Sheet after filter | Macro Code to delete hidden rows in Excel Sheet after filter

 

VBA Code to delete hidden rows in Excel Sheet after filter | Macro Code to delete hidden rows in Excel Sheet after filter 


Open Excel sheet and Press Alt F11

Click on Insert Button and Insert new module

Paste the below code and save.

Before saving the code you must enable the sheet as Macro Enabled Sheet.

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

No comments:

Post a Comment