This post will guide you how to delete all visible rows or columns in Excel. How do I select only the visible cells in Excel 2013/2016. How to delete only visible rows without the hidden rows in Excel.
- Delete Visible Rows with Go To Special Feature
- Delete Visible Rows with VBA Macro
- Video: Delete Visible Rows
Delete Visible Rows with Go To Special Feature
Assuming that you have a list of data in range A1:C4, and you have hidden one row (Row 2) in your table, and you want to delete all visible data in your range, if you select range A1:C4, all hidden values also will be deleted. So how to only select the visible values and then delete only visible values without the hidden values in Excel. You just need to do the following steps:
#1 select the range of cells A1:C4 that you want to delete all visible values.
#2 go to HOME tab, click Find & Select command under Editing group. And select Go To Special menu from the drop-down list. And the Go To Special dialog will open.
#3 select Visible cells only radio button under Select section. And click OK button.
#4 only visible cells will be selected, and if you delete those values, just press Delete key in your keyboard.
#5 all visible values are deleted. And you can show all hidden values if they are still kept.
Delete Visible Rows with VBA Macro
You can also use an Excel VBA Macro to achieve the result of deleting all visible rows in your selected range of cells. Just do the following steps:
#1 open your excel workbook and then click on “Visual Basic” command under DEVELOPER Tab, or just press “ALT+F11” shortcut.
#2 then the “Visual Basic Editor” window will appear.
#3 click “Insert” ->”Module” to create a new module.
#4 paste the below VBA code into the code window. Then clicking “Save” button.
Sub DeleteAllVisibleRows() Dim myRange As Range Set myRange = Application.Selection Set myRange = Application.InputBox("Select one Range that you want to delete visible rows", "DeleteAllVisibleRows", myRange.Address, Type:=8) myRange.SpecialCells(xlCellTypeVisible).ClearContents End Sub
#5 back to the current worksheet, then run the above excel macro. Click Run button.
#6 Select one range that you want to delete all visible rows, such as:A1:C4.
#7 let’s see the result:
Leave a Reply
You must be logged in to post a comment.