

- #EASY WAY TO DELETE BLANK ROWS IN EXCEL FOR MAC HOW TO#
- #EASY WAY TO DELETE BLANK ROWS IN EXCEL FOR MAC UPDATE#
- #EASY WAY TO DELETE BLANK ROWS IN EXCEL FOR MAC CODE#
- #EASY WAY TO DELETE BLANK ROWS IN EXCEL FOR MAC DOWNLOAD#
'Display Yes/No message prompt before deleting rows Sub Delete_Rows_Based_On_Value_Table_Message() The macro below also tells you the number of rows it is going to delete, and asks if you want to proceed. You can create a custom message box before deleting rows, instead of the default Excel warning to delete rows. I've also included a few additional macros to help customize the process further. Lo.DataBodyRange.SpecialCells(xlCellTypeVisible).Delete Lo.Range.AutoFilter Field:=4, Criteria1:="Product 2" 'Apply a filter to a Table and delete visible rows
#EASY WAY TO DELETE BLANK ROWS IN EXCEL FOR MAC CODE#
Here is the code you would use for a Table. The code is almost the same, but tweaked slightly so that it applies to Tables. If your data is in an Excel Table instead of just a range of cells, you can still delete rows based on cell contents using a macro. These are alerts you might see from Excel when deleting ranges, deleting sheets, closing without saving, etc. Setting it to False will turn off the alerts. The Application.DisplayAlerts property is a toggle to turn warning alerts on/off. So that portion of the macro now looks like this: '2. If you want to run the macro without having that pop-up box interrupting, you can simply remove the apostrophes before the two lines of code that begin with Application.DisplayAlerts. When you run the macro you will receive a pop-up warning message that says “Delete entire sheet row?”
#EASY WAY TO DELETE BLANK ROWS IN EXCEL FOR MAC UPDATE#
You will just need to update the Worksheet and Range references for your specific file. Ws.Range("B4:G1000").SpecialCells(xlCellTypeVisible).Delete Ws.Activate 'not required but allows user to view sheet if warning message appears Set ws = ThisWorkbook.Worksheets("Regular Range") 'Set reference to the sheet in the workbook. 'Apply a filter to a Range and delete visible rows
#EASY WAY TO DELETE BLANK ROWS IN EXCEL FOR MAC DOWNLOAD#
The code is also included in the Excel file in the Download section above. The VBA code below can be copy/pasted to the VB Editor. This ensures that there are no filters applied to other columns that could cause additional rows to be filtered out.Ī big thanks to Hoang for pointing this out on the YouTube video! The VBA Macro Code Important Note: I added a step to clear all filters in the range or Table at the beginning of the macro. It's a simple 2 or 3 step macro that will save time from doing this process manually.
#EASY WAY TO DELETE BLANK ROWS IN EXCEL FOR MAC HOW TO#
Checkout my article and video on how to copy & paste visible cells to learn more.įinally, the macro can also clear the filters so that you are left viewing the entire data range, minus the rows you've deleted. This is the same as using the Go To Special menu (keyboard shortcut Alt+ ) to select blanks. It uses the SpecialCells method to create a reference to the visible cells. Next, the macro simply deletes all of the visible rows that have been left by the filter. To remove the rows that have blank cells like this one, the macro first applies a filter to the product column. You can see one of those blank cells is E6.

Skill Level: Intermediate Download the Excel File

Bottom Line: Learn how to use VBA macros to delete rows based on cell values or conditions.
