+ Reply to Thread
Results 1 to 5 of 5

Macro to hide/show rows and columns

  1. #1
    Leo
    Guest

    Macro to hide/show rows and columns

    I have a Excel worksheet using cells A1 to H430. There are quite a few empty
    lines in this area, and when I print it out I don't want the empty lines. I
    want to write a macro that will check column A (row headings), if one cell
    has no content then the macro will hide the whole row.

    Can someone please show me how this can be done in VBA code? Thanks a lot.



  2. #2
    CLR
    Guest

    RE: Macro to hide/show rows and columns

    ASAP Utilities, a free Add-in available at www.asap-utilities.com has a
    feature that will do this for you..........

    Vaya con Dios,
    Chuck, CABGx3




    "Leo" wrote:

    > I have a Excel worksheet using cells A1 to H430. There are quite a few empty
    > lines in this area, and when I print it out I don't want the empty lines. I
    > want to write a macro that will check column A (row headings), if one cell
    > has no content then the macro will hide the whole row.
    >
    > Can someone please show me how this can be done in VBA code? Thanks a lot.
    >
    >


  3. #3
    Bob Phillips
    Guest

    Re: Macro to hide/show rows and columns

    Not exactly sure what you want to hide, but this may help

    Dim oRow As Range
    For Each oRow In Range("A1:H43").Rows
    If Cells(oRow.Row, "F").Value = "" Then
    oRow.EntireRow.Hidden = True
    End If
    Next oRow

    --
    HTH

    Bob Phillips

    (remove xxx from email address if mailing direct)

    "Leo" <[email protected]> wrote in message
    news:[email protected]...
    > I have a Excel worksheet using cells A1 to H430. There are quite a few

    empty
    > lines in this area, and when I print it out I don't want the empty lines.

    I
    > want to write a macro that will check column A (row headings), if one cell
    > has no content then the macro will hide the whole row.
    >
    > Can someone please show me how this can be done in VBA code? Thanks a

    lot.
    >
    >




  4. #4
    Leo
    Guest

    RE: Macro to hide/show rows and columns

    Thanks a lot. I will try it out.

    "CLR" wrote:

    > ASAP Utilities, a free Add-in available at www.asap-utilities.com has a
    > feature that will do this for you..........
    >
    > Vaya con Dios,
    > Chuck, CABGx3
    >
    >
    >
    >
    > "Leo" wrote:
    >
    > > I have a Excel worksheet using cells A1 to H430. There are quite a few empty
    > > lines in this area, and when I print it out I don't want the empty lines. I
    > > want to write a macro that will check column A (row headings), if one cell
    > > has no content then the macro will hide the whole row.
    > >
    > > Can someone please show me how this can be done in VBA code? Thanks a lot.
    > >
    > >


  5. #5
    Leo
    Guest

    Re: Macro to hide/show rows and columns

    Thanks a lot Bob. This probably is the coding I am looking for. The rows I
    want to hide are those who have no content in column A. i.e., if A10 has no
    content, hide the entire 10th row.

    I will try your code to see if it works. Thanks again.


    "Bob Phillips" wrote:

    > Not exactly sure what you want to hide, but this may help
    >
    > Dim oRow As Range
    > For Each oRow In Range("A1:H43").Rows
    > If Cells(oRow.Row, "F").Value = "" Then
    > oRow.EntireRow.Hidden = True
    > End If
    > Next oRow
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (remove xxx from email address if mailing direct)
    >
    > "Leo" <[email protected]> wrote in message
    > news:[email protected]...
    > > I have a Excel worksheet using cells A1 to H430. There are quite a few

    > empty
    > > lines in this area, and when I print it out I don't want the empty lines.

    > I
    > > want to write a macro that will check column A (row headings), if one cell
    > > has no content then the macro will hide the whole row.
    > >
    > > Can someone please show me how this can be done in VBA code? Thanks a

    > lot.
    > >
    > >

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1