Forum Discussion
Cami96
Jan 17, 2020Copper Contributor
Allow Macro to Run on Locked Sheet
Hey everyone! I have a recorded macro to filter out all blank cells in my table. The macro looks like this: Sub filter_blank() ' ' filter_blank Macro ' ' Keyboard Shortcut: Ctrl+j ' ...
- Jan 17, 2020
Cami96 -
Did you try https://www.thespreadsheetguru.com/the-code-vault/insert-delete-table-rows-with-worksheet-protection?
What you accomplished with the Macro Recorder you can also create as:
Option Explicit Dim tableToDeleteRows As ListObject Sub deleteEmptyTableRows() Set tableToDeleteRows = ThisWorkbook.Sheets("Sheet1").ListObjects("Table1") Dim i As Long With tableToDeleteRows For i = .ListRows.Count To 1 Step -1 If Trim(.ListRows(i).Range.Cells(1)) = vbNullString Then .ListRows(i).Delete End If Next i End With End SubIt's a nice little procedure to get you into thinking programmatically.
Abiola1
Jan 18, 2020MVP