+ Reply to Thread
Results 1 to 5 of 5

Run Macro and Calculate Formula ONLY in current Worksheet

  1. #1
    Registered User
    Join Date
    06-23-2012
    Location
    Ontario
    MS-Off Ver
    Excel 2010
    Posts
    7

    Run Macro and Calculate Formula ONLY in current Worksheet

    I have a workbook that incorporates 3-4 bimonthly sheets for the entire year (2016 was 79 sheets)

    The sheets are created by a macro that copies the master sheet and then depending on the entry into certain cells the sheet is renamed.

    That said, each worksheet has the following code:

    Please Login or Register  to view this content.
    My client does not like change and she isn't the greatest typist so I made it so she does not have to capitalize anything the macro does it for her each time she types.

    In addition, I have formulas and conditional formatting that changes what is in one of the columns and the second part is for auto fitting the column width to match the result.

    The problem I am having is as the Workbook grows, the calculation seems to be taking longer.

    Is there a way to only have the calculation be on when the sheet is active, so that other sheets don't recalculate?

    Not sure if I am explaining this properly, but I thought I'd give it a go.

    Thanks very much, so much of what I have so far has come from you all!
    Last edited by DebDobson; 01-27-2017 at 11:10 AM.

  2. #2
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Run Macro and Calculate Formula ONLY in current Worksheet

    Hi Deb,

    Have you set the Calculation Mode to Manual?

    You can press Ctrl+Shift+F9 to calculate just the active sheet.

    The Worksheet_Calculate event fires AFTER the worksheet is calculated, so you probably can't control the amount that gets calculated here.

    Perhaps the code ActiveSheet.Calculate can help in a macro. (Selection.Calculate can be used to calculate a range.

    I hope this helps, please let me know!

    Regards,

    David

    If this has been helpful
    - Please click on the *Add Reputation button at the bottom left.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".


  3. #3
    Registered User
    Join Date
    06-23-2012
    Location
    Ontario
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Run Macro and Calculate Formula ONLY in current Worksheet

    Thanks for answering me! I appreciate it.

    To clarify, are you suggesting that I try:

    1. Set the Calculation Mode to Manual
    2. Add the Code ActiveSheet.Calculate

    Probably a stupid question (I have memory problems, so although I've taken a few courses, it doesn't stick with me)...

    Where in the above VBA would I put ActiveSheet.Calculate ?

  4. #4
    Registered User
    Join Date
    06-23-2012
    Location
    Ontario
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Run Macro and Calculate Formula ONLY in current Worksheet

    Thanks for answering me! I appreciate it.

    To clarify, are you suggesting that I try:

    1. Set the Calculation Mode to Manual
    2. Add the Code ActiveSheet.Calculate

    Probably a stupid question (I have memory problems, so although I've taken a few courses, it doesn't stick with me)...

    Where in the above VBA would I put ActiveSheet.Calculate ?

  5. #5
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Run Macro and Calculate Formula ONLY in current Worksheet

    Hi Deb,

    Yes, I am suggesting that you try setting the Calculation Mode to Manual.

    This will stop the workbook from recalculating all the time (which can be very irritating with a WB full of formulas).

    If you press F9, the whole workbook will be recalculated. If you press Shift + F9, just the current sheet will recalculate.

    Pressing Shift +F9 or F9 will cause the Private Sub Worksheet_Calculate event to run AFTER the calculation has finished. This is why I was trying to say that you could use ActiveSheet.Calculate somewhere else. Perhaps another subroutine.

    If using my first suggestion works - ignore the extra code. Sorry if I confused you!

    I hope this is a little more helpful, please let me know!

    Regards,

    David

    If this has been helpful
    - Please click on the *Add Reputation button at the bottom left.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".


+ 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. [SOLVED] Action Macro to Select an area but retain current view of worksheet
    By Craigside in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-16-2015, 02:58 PM
  2. Macro to create new worksheet from the current worksheet, with additional changes
    By sards08 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-13-2013, 04:13 PM
  3. [SOLVED] Macro to move cursor to column containing current date at worksheet activation
    By Snoddas in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-03-2013, 05:40 AM
  4. How to use a macro to save worksheet as pdf to current folder
    By lriver2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-13-2013, 05:03 PM
  5. [SOLVED] Macro to create new worksheet from template and link to it from current cell?
    By chemoul in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 08-15-2012, 07:00 PM
  6. Macro to sort current tab worksheet i'm on by V U T
    By donnydorko in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-26-2009, 02:27 PM
  7. Can I control Macro run automatically current worksheet?
    By Microlong in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-02-2005, 09:06 AM

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