Results 1 to 7 of 7

Optimizing code speed: Hiding rows with loops - looking for faster way

Threaded View

  1. #1
    Registered User
    Join Date
    08-19-2012
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    50

    Optimizing code speed: Hiding rows with loops - looking for faster way

    Hello!
    The following code hid the rows of the listed cells if the cell does not contain anything if I click on the checkbox in my sheet and unhides them if I click again. The problem is that it needs about 5 to 7 seconds for the rows to disappear and I would like to have it faster. Does anyone have an idea how to get the same result faster? Without that many loop stages?
    If Range("B63").Value = True Then
                Set myRng = Range("C4,C5,C6,C7,C8,C9,C10,C12,C13,C14,C15,C16,C17,C18,C19,C21,C22,C23,C24,C25,C26,C28,C29,C30,C31,C32,C33,C34,C35,C37,C38,C40,C41,C42,C43,C44,C45,C46,C48,C49,C51,C52,C53,C54,C55,C56,C57,C59,C60,C61")
                For Each myCell In myRng.Cells
                    If myCell.Value = "" Then
                    myCell.EntireRow.Hidden = True
                    End If
                Next myCell
    Else
    Range("C1:C65536").EntireRow.Hidden = False
    Greetings,
    Taktiker
    Last edited by Taktiker; 11-07-2012 at 04:24 PM.

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