code to hide grouped rows

  • Hello all


    when you use
    ActiveCell.Rows("1:60").EntireRow.Select
    Selection.Rows.group
    works fine,


    Now in the Excel mode, there is a (-) {for grouping} just besides the colmun that holds the numbers of the sheet rows, so when you hit it then the group of rows is hiden........


    i tried several time writing a code does this job, but................
    even this code (Selection.Rows.Ungroup) does not hide the rows


    appreciate any hints


    yours
    hesham

    ******************
    [SIZE=6]Yours
    h [/SIZE]

    Your Help Is Highly Appreciated

  • Thank you David


    Thanks David............this works fine and does the job...ok


    but when i recorded a macro, it does not show such code


    yours
    hesham

    ******************
    [SIZE=6]Yours
    h [/SIZE]

    Your Help Is Highly Appreciated

  • Thank you David


    Thank u David
    It works fine,but


    when i recorded a macro to do this, it does not show this code, even i pressed the right bottom of the recording bar



    yours
    hesham

    ******************
    [SIZE=6]Yours
    h [/SIZE]

    Your Help Is Highly Appreciated

  • Hide/Unhide Rows/Columns


    This little snippet of code should help you figure out how to hide/unhide rows and columns.
    Good luck.



    Sub UnhideRowsColumns()


    Sheets("YourSheet").Select
    Rows("6:92").Select
    Selection.EntireRow.Hidden = False
    Columns("A:IC").Select
    Selection.EntireColumn.Hidden = False
    Range("A1").Select
    End Sub


    Sub HideRowsColumns()


    Sheets("YourSheet").Select
    Rows("1:92").Select
    Selection.EntireRow.Hidden = True
    Columns("A:IC").Select
    Selection.EntireColumn.Hidden = True
    Range("A1").Select
    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!