Hiding Rows if Blank cell

  • Thread starter Thread starter mohd21uk via OfficeKB.com
  • Start date Start date
M

mohd21uk via OfficeKB.com

Hi,

I would like to hide a row if a cell in the row is blank. For e,g.If cell C22
is blank i would like to hide the row. Is there an easy function that would
do this or would I have to use a macro.
 
Paste following code in Worksheet's code (right-click on tab name, select
Code)

HTH
--
AP

'------------
Private Sub Worksheet_Change(ByVal Target As Range)
With Range("c22")
.EntireRow.Hidden = (.Value = "")
End With
End Sub
'------------
 
You nee VBA

For i = Cells(Rows.Count,"C").End(xlUp).Row to 1 Step -1
If Cells(i,"C").Value = "" Then
Rows(i)>Hidden = True
End If
Next i

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
You can also try this one. This method will help you to do the said thing in
every old and new workbook, where as you have to paste the code in every
workbook or sheet.

1. Press Ctrl+G to open Goto Window (without selecting anything)
2. Here click the Special button.
3. Click Blanks and press Ok.
4. You will see the all the blank cells within your data will be selected.
5. Press CTRL+9 to hide the selected rows.

Maybe that is what you want. One more thing. To Unhide any hidden rows
within the selection press CTRL+SHIFT+9 or you can say CTRL+SHIFT+( (opening
parenthesis).

Check out the following link, here you will see very useful shortcut key for
Microsoft Excel.

http://office.microsoft.com/en-gb/assistance/HP052037811033.aspx

If the above was useful to you then let us know!
 

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

Back
Top