+ Reply to Thread
Results 1 to 4 of 4

Slow Code for Hiding Rows

  1. #1
    Registered User
    Join Date
    01-14-2009
    Location
    Worcester, England
    MS-Off Ver
    Excel 2007
    Posts
    19

    Slow Code for Hiding Rows

    Hi All.

    I have some code which looks for the word "Out" in column "L" and hides the row if it finds it. This is running from row 24 to 160 and takes about a minute to run. I've tried two different solutions, neither really quicker than the other. If anyone has a more efficient method of doing this I'd appreciate your input!

    Thanks

    Simon

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by Simon Austin; 09-15-2009 at 08:39 AM. Reason: Solved!

  2. #2
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Re: Slow Code for Hiding Rows

    Hi Simon,

    Code:
    Dim Counter As Integer
    For Counter = 24 To 160
    Rows(Counter).Select
    If Cells(Counter, 12).Value = "Out" Then Selection.EntireRow.Hidden = True
    Next Counter
    In this case, there is no need to select the row each time (Rows(Counter).Select). You can try using this code. It should be fast.

    Please Login or Register  to view this content.
    Another way to achieve this would be to use Custom Filter --> Not Equal To --> "Out". This would be the fastest way to do it.

    Regards,
    Karan
    Last edited by karan; 09-15-2009 at 08:04 AM. Reason: Extra Info

  3. #3
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Slow Code for Hiding Rows

    Try with this code (may be faster):
    Please Login or Register  to view this content.
    Regards,
    Antonio

  4. #4
    Registered User
    Join Date
    01-14-2009
    Location
    Worcester, England
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Slow Code for Hiding Rows

    Awesome, thanks Karan and Antonio.

    Antonio's code has it running super fast now!!

    Simon

+ 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