+ Reply to Thread
Results 1 to 7 of 7

How do i speed up my hiderows code?

  1. #1
    Registered User
    Join Date
    03-01-2012
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2010
    Posts
    64

    How do i speed up my hiderows code?

    Hi all

    I use the following small piece of code to hide rows based on whether the value in the Range is an 'x'.

    Please Login or Register  to view this content.
    The problem is it takes so looooong to work through the worksheet and hide the required rows! Is there anything I can do to speed this up? I was hoping it would work faster (ideally as fast as a filter would take). The actual range of the data table in question is from C17 to AC172, so could the code be amended so it doesn't have to go through each entire row?

    Thanks for any help on this

    Kenny

  2. #2
    Valued Forum Contributor
    Join Date
    08-13-2012
    Location
    Gardony, Hungary
    MS-Off Ver
    Excel 2003
    Posts
    558

    Re: How do i speed up my hiderows code?

    Hey,

    you shouldn't loop through the rows one by one, instead hide the whole range at once.

  3. #3
    Valued Forum Contributor
    Join Date
    09-04-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    463

    Re: How do i speed up my hiderows code?

    upload a sample workbook

    Regard
    CA Mahaveer Somani

  4. #4
    Valued Forum Contributor
    Join Date
    08-13-2012
    Location
    Gardony, Hungary
    MS-Off Ver
    Excel 2003
    Posts
    558

    Re: How do i speed up my hiderows code?

    Here is a procedure that does something similar, not sure if this is exactly what you need though.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-01-2012
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2010
    Posts
    64

    Re: How do i speed up my hiderows code?

    hi RHCPgergo

    I'm going to give your code a go but i don't want to delete the rows just hide them (so they can be unhidden later if required), sorry but how do i amend your code to do this please?

    Thanks
    Kenny

  6. #6
    Valued Forum Contributor
    Join Date
    08-13-2012
    Location
    Gardony, Hungary
    MS-Off Ver
    Excel 2003
    Posts
    558

    Re: How do i speed up my hiderows code?

    Oh, sorry. Just change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-01-2012
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2010
    Posts
    64

    Re: How do i speed up my hiderows code?

    i did think it was that and the code wasn't working, but since just realised i'd not included another line of the code by mistake, so thanks very much for your help! it's much faster using this method, i'm not familiar with the union command in VBA so thanks for pointing this one out to me

    Kenny

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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