+ Reply to Thread
Results 1 to 4 of 4

Stop delay on macro

  1. #1
    Registered User
    Join Date
    09-18-2009
    Location
    england
    MS-Off Ver
    Excel 2003
    Posts
    24

    Stop delay on macro

    I have the following code that hides any row within the range that is zero. However, there is a around a 10 second delay when clicking onto the sheet. I have tried using screen updating but there is still this delay. Does anyone know what i can do to avoid this.

    Thanks

    Private Sub Workbook_SheetActivate(ByVal Sh As Object)

    Application.ScreenUpdating = False

    Dim arrSheets()
    Dim lngRowNum As Long

    arrSheets = Array("Bold", "Heatons")
    If Not IsError(Application.Match(Sh.Name, arrSheets, 0)) Then
    For lngRowNum = 6 To 55
    Rows(lngRowNum).Hidden = Cells(lngRowNum, 45).Value = 0
    Next lngRowNum
    End If

    Application.ScreenUpdating = True

    End Sub

  2. #2
    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 Re: Stop delay on macro

    Come on fatpiggy123, you have 19 posts to your name : you should know the rules by now.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Registered User
    Join Date
    09-18-2009
    Location
    england
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Stop delay on macro

    Whoops, slap on the risk, sorry.

    I have the following code that hides any row within the range that is zero. However, there is a around a 10 second delay when clicking onto the sheet. I have tried using screen updating but there is still this delay. Does anyone know what i can do to avoid this.

    Thanks

    Please Login or Register  to view this content.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Stop delay on macro

    Please edit the original post, don't just add another

    Avoid the looping & try using autofilter
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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