+ Reply to Thread
Results 1 to 16 of 16

Screen 'Flashing' when refreshing Pivot Tables

  1. #1
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Screen 'Flashing' when refreshing Pivot Tables

    I have a worksheet which contains a number of pivot tables for use as a dashboard. The actual pivots themselves are all hidden but their output shown in different cells on the sheet. I want the pivots to all automatically update when the user changes data on another sheet, which I am doing using this code. The code does the job but the dashboard sheet looks a bit 'messy' when updating all the pivots, by that I mean the refresh for each pivot makes the screen redraw and it just doesn't look so great. Is there any way to adapt the code so that this doesn't happen or only happens once rather than for each individual pivot refresh so it looks much smoother?

    I can't easily upload a sample because the data is sensitive and has taken many many hours to create. I think it is simply an issue of screen redraw/refresh.

    Please Login or Register  to view this content.
    Many thanks

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen 'Flashing' when refreshing Pivot Tables

    Try adding

    Application.ScreenUpdating = False at the beginning of the code after the Sub Statement & Application.ScreenUpdating = True at the end before the End Sub Statement
    Last edited by NeedForExcel; 07-08-2015 at 06:11 AM.
    Cheers!
    Deep Dave

  3. #3
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen 'Flashing' when refreshing Pivot Tables

    Duplicate Post By Error!
    Last edited by NeedForExcel; 07-08-2015 at 06:10 AM.

  4. #4
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Screen 'Flashing' when refreshing Pivot Tables

    A million times better, works like a charm...

    Many thanks for your help

  5. #5
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen 'Flashing' when refreshing Pivot Tables

    Glad it helped!

  6. #6
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Screen 'Flashing' when refreshing Pivot Tables

    Actually, one further thought. Ideally I want the sheet in question to be protected but of course it won't refresh the pivots when it is protected. Is there a way to further adapt the code to unprotect the sheet whilst the refresh is happening and then to protect it again once refreshed?

    Not sure how that would work in practice?

  7. #7
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen 'Flashing' when refreshing Pivot Tables

    Yes you can Lock & Unlock Worksheets before & after the operation

    ActiveSheet.Protect "YourPasswordHere"

    ActiveSheet.UnProtect "YourPasswordHere"

  8. #8
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Screen 'Flashing' when refreshing Pivot Tables

    Okay, now I'm confused, added the code ActiveSheet.Protect "YourPasswordHere" before Application.ScreenUpdating = False and then ActiveSheet.UnProtect "YourPasswordHere" after Application.ScreenUpdating = True.

    The sheet doesn't actually have a password, so simply used "" but I got an error, so tried adding a password 'pass', still had the error, commented out all the code and now the sheet is asking for a password to unlock the sheet and whatever I enter, either nothing or 'pass', I now have the message 'The password you supplied is not correct and subsequently I can now not unlock the sheet.

    Any idea how I can get round this problem first and then, am I adding the Protect and Unprotect in the correct place?

  9. #9
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen 'Flashing' when refreshing Pivot Tables

    If your sheet has no password then just use ActiveSheet.Protect

    No Need for ""

  10. #10
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Screen 'Flashing' when refreshing Pivot Tables

    Okay, perfect, that did the trick, thank you...

    Is there any way to achieve the same thing when using 'slicers' on the sheet itself. Every time a different button is selected on the slicer the same thing is effectively happening in that the screen refreshes giving a similar 'issue'?

  11. #11
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen 'Flashing' when refreshing Pivot Tables

    So you are saying every time a Slicer Button is clicked, you do not want screen updated?

  12. #12
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Screen 'Flashing' when refreshing Pivot Tables

    Good point, I guess there is no way around that one, not the end of the world, I guess I'll just have to live with it...

    Many thanks for all your help once again...

  13. #13
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen 'Flashing' when refreshing Pivot Tables

    No Problem!

  14. #14
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Screen 'Flashing' when refreshing Pivot Tables

    Um,

    So, I thought this was working but there is a problem. There are other sheets containing pivot tables using the same source data, so I now get a constant error which says:

    Run-time error '1004'
    That command cannot be performed while a protected sheet contains another PivotTable report based on the same source data.

    I've assumed it is referring to other portected sheets in the workbook, but even unprtecting every sheet in the workbook, the problem still exists, so unsure if it is referring to the other sheets or other PivotTables on the same sheet?

    Please Login or Register  to view this content.
    Any ideas?

  15. #15
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen 'Flashing' when refreshing Pivot Tables

    Is it possible to attach your sample Workbook?

  16. #16
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Screen 'Flashing' when refreshing Pivot Tables

    I can't attach the actual workbook due to confidentiality, but I've managed to quickly recreate the problem using the attached. Basically it appears that if you have a pivot table that uses the same source data on another protected sheet then that is causing the issue.

    On the attached I've added four PivotTables to the tab called Pivot and added the code to 'UnProtect, Refresh the Pivots and then Protect' the sheet again. On it's own that all works fine but then I've added a second sheet called More Pivots, added a PivotTable there using the same data source, protected that sheet and that's when the problem starts.

    If you now simply click once on the Data tab you will see the run-time error. If you then UnProtect the sheet called More Pivots the problem goes away. What is odd though is that on my main sheet, I've UnProtected ALL the sheets and I'm having the porblem, so I don't know whether Excel somehow stores details of previously deleted sheets or something, but I really need to be able to Protect some of the other sheets in the Workbook.

    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Refreshing pivot tables..
    By geliedee in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-25-2013, 12:32 AM
  2. Refreshing Pivot tables
    By j_Southern in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-29-2012, 10:51 PM
  3. Excel 2007 : Refreshing Pivot Tables
    By muralikreddy in forum Excel General
    Replies: 3
    Last Post: 06-17-2010, 06:15 AM
  4. Refreshing multiple pivot tables
    By jerredjohnson in forum Excel General
    Replies: 2
    Last Post: 05-02-2006, 01:30 PM
  5. Refreshing pivot tables
    By matpj in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-20-2006, 11:40 AM

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