Hide Blank Rows

T

TamIam

I don't know how to use macros, (I'm assuming I would need one), but does
anyone know of one I could copy/paste into my spreadsheet that will hide
blank rows within a specific range?
 
J

Jacob Skaria

Set the Security level to low/medium in (Tools|Macro|Security). 'Launch VBE
using short-key Alt+F11. Insert a module and paste the below code. Save. Get
back to Workbook. Tools|Macro|Run the macro()

Change the range as required

Sub RemoveBlankRows()
Dim varRange As Range
Dim lngRow As Long
Set varRange = Range("A1:Z10")

For lngRow = varRange.Rows.Count To varRange.Row Step -1
If WorksheetFunction.CountBlank(Rows(lngRow)) = Columns.Count Then
Rows(lngRow).Delete
End If
Next
End Sub
 
D

Dennis Tucker

To do this manually, select the entire rows you want to hide by clicking on
the row IDs(1,2,3...) while holding the Ctrl key. Then when all selection
is complete, right click on one of the selected row IDs and choose Hide.

To make a macro to do the same thing, access the macro recorder and start a
macro recording then repeat the same thing from above. Then turn of the
recorder. You can then view, edit, run or delete the macro you recorded.


Dennis
 
G

Gord Dibben

You don't need a macro.

Select a column within the range and F5>Special>Blanks>OK

Format>Row>Hide.


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top