Excel: Masquer la ligne si la cellule X est vide

gumao Posted messages 1 Status Member -  
eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   -
Hello,

I am using Excel 2007. I would like Excel to automatically hide the rows of a sheet if the first cell of the row is empty. For example, if cell A1 is empty, hide row 1. I imagine I need to create a macro, but I don't know how to do it, can you please help me? Thank you.

Configuration: Windows XP / Internet Explorer 7.0

2 answers

  1. cousinhub29 Posted messages 1113 Registration date   Status Member Last intervention   383
     
    Hello,

    Without macro, using auto filters.....(uncheck Blanks)

    Good night

    Edit :

    Or by macro, without loops:

    Columns(1).SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True 


    See you later
    9
    1. Ptitpere21 Posted messages 9 Status Member
       
      Hello

      I like your macro but it seems to test for blanks, while in my case the column I'm testing contains either 0 or a phrase. How can I adapt it?

      Thank you in advance.
      0
    2. eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
       
      Hello,

      SpecialCells(XlCellType) only allows access to a particular type of cells.
      See the list in the help:
      XlCellType can be one of these XlCellType constants.
      xlCellTypeAllFormatConditions. Cells of any format
      xlCellTypeAllValidation. Cells with validation criteria
      xlCellTypeBlanks. Empty cells
      xlCellTypeComments. Cells containing comments
      xlCellTypeConstants. Cells containing constants
      xlCellTypeFormulas. Cells containing formulas
      xlCellTypeLastCell. Last cell in the used range
      xlCellTypeSameFormatConditions. Cells with the same format
      xlCellTypeSameValidation. Cells with the same validation criteria
      xlCellTypeVisible. All visible cells

      You have to make a loop.

      eric
      0