Results 1 to 3 of 3

Thread: *Resolved* Excel VBA: Freeze Worksheet Calculation?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2004
    Location
    Right here
    Posts
    275

    Resolved *Resolved* Excel VBA: Freeze Worksheet Calculation?

    Hi,

    Is there any way to freeze (prevent) a number of worksheets from recalculating when a VBA macro is running?

    I have a spreadsheet with about 10 worksheets, most of which are linked to each other in some way. One of my macros only needs to use the formulas (and related results) from about 7 of these, so the other 3 are updating all the time but since the results from these are not needed then they are slowing down my code.

    Is there some VBA function for temporarily disabling a worksheets calculation function? I would need my code to look something like this:

    Code:
    Worksheet("sheet1").Calculate:False
    Worksheet("sheet2").Calculate:False
    Worksheet("sheet3").Calculate:False
    
    *Execute the macro code*
    
    Worksheet("sheet1").Calculate:True
    Worksheet("sheet2").Calculate:True
    Worksheet("sheet3").Calculate:True
    Is something like this possible?

    Thanks
    -Rob
    Last edited by TheRobster; Oct 6th, 2005 at 06:13 PM.
    http://www.sudsolutions.com

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Excel VBA: Freeze Worksheet Calculation?

    I think the best you could do is to only calculate a range instead of an entire sheet or workbook.
    VB Code:
    1. Worksheets(1).Rows(8).Calculate
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    Lively Member JustinLabenne's Avatar
    Join Date
    Jul 2005
    Location
    Ohio
    Posts
    64

    Re: Excel VBA: Freeze Worksheet Calculation?

    Depending on what your needs are, ManualCalculation may help also
    VB Code:
    1. With Application
    2. .Calculation = xlCalculationManual
    3.  
    4.     Sheet1.Calculate
    5.     Sheet2.Calculate
    6. '    chain more sheets together as needed
    7.  
    8.     'your macro
    9.    
    10. .Calculation = xlCalculationAutomatic
    11. End With
    Justin Labenne
    www.jlxl.net

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width