+ Reply to Thread
Results 1 to 4 of 4

Hide Rows From a Row to Last usedCell.Row

  1. #1
    Forum Contributor
    Join Date
    03-09-2004
    Posts
    140

    Hide Rows From a Row to Last usedCell.Row

    Hi there
    i want to hide from lRow Down to the last used Cell.

    I tried to modify this code , but could not make it work.

    Please Login or Register  to view this content.
    an idea ?
    Yours
    hesham Almakki
    http://www.almakki.com.ly/

  2. #2
    STEVE BELL
    Guest

    Re: Hide Rows From a Row to Last usedCell.Row

    Just a minor change in your code should do it...
    ==================
    Dim lRow As Long

    lRow = Selection.Row
    If lRow <= 5 Then Exit Sub

    Range(Rows(lRow), Rows(Selection.End(xlDown).Row)).EntireRow.Hidden = True
    ===========================================================
    you could also use:

    Range(Rows(Selection.Row), Rows(Selection.End(xlDown).Row)).EntireRow.Hidden
    = True

    (works in Excel 2000)
    --
    steveB

    Remove "AYN" from email to respond
    "helmekki" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi there
    > i want to hide from lRow Down to the last used Cell.
    >
    > I tried to modify this code , but could not make it work.
    >
    >
    > Code:
    > --------------------
    > Sub Macro2()
    > Dim lRow As Long
    >
    > lRow = Selection.Row
    > If lRow <= 5 Then Exit Sub
    >
    > Rows("lRow:" & Selection.End(xlDown)).EntireRow.Hidden = True
    >
    > End Sub
    > --------------------
    >
    >
    > an idea ?
    >
    >
    > --
    > helmekki
    >
    >
    > ------------------------------------------------------------------------
    > helmekki's Profile:
    > http://www.excelforum.com/member.php...fo&userid=6939
    > View this thread: http://www.excelforum.com/showthread...hreadid=377831
    >




  3. #3
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good evening Helmekki

    Slight departure from your code, but it's neat and seems to work OK. It actually hides the rows from the currently active cell row right up to the last row containing information.

    Sub Test()
    lastrow = ActiveSheet.UsedRange.Rows.Count + 1
    nowrow = ActiveCell.Row + 1
    For f = nowrow To lastrow
    Rows(f).Select
    Selection.EntireRow.Hidden = True
    Next f
    End Sub

    Is that any good to you?

    HTH

    DominicB

  4. #4
    Forum Contributor
    Join Date
    03-09-2004
    Posts
    140

    Thumbs up

    Oh God..................

    Thank u very very much..............


+ 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