+ Reply to Thread
Results 1 to 5 of 5

Application.ScreenUpdating Switching Worksheet

  1. #1
    Registered User
    Join Date
    03-26-2021
    Location
    Birmingham, Alabama
    MS-Off Ver
    Office 2016
    Posts
    7

    Application.ScreenUpdating Switching Worksheet

    The issue I am having isn't huge, but it will confuse my team leaders when they need to run this workbook.

    I am using ScreenUpdating in a few print option macros, and the macros work fine, but when I turn ScreenUpdating back on, it changes the worksheet to a different one. All 3 macros, even the one that does not reference the sheet they land on, revert back to Sheet25 (Aka P3.5 Shift Notes) after printing, even though the macro buttons live on Sheet30 (PRINT ME).

    Sub PrintAll_Update()
    Application.ScreenUpdating = False
    Sheet25.AutoFilterMode = False
    Sheet25.Range("M3:M105").EntireRow.AutoFit
    Sheet25.Range("O3:o105").AutoFilter 1, "1", , , False
    Sheet26.AutoFilterMode = False
    Sheet26.Range("M4:M69").EntireRow.AutoFit
    Sheet26.Range("AG4:AG69").AutoFilter 1, "1", , , False
    Sheets(Array("P3.5 Shift Notes", "TH Board Summary")).PrintOut
    Sheets(Array("P4 Shift Notes")).PrintOut
    Application.ScreenUpdating = True
    End Sub


    Sub PrintPIM_Update()
    Application.ScreenUpdating = False
    Sheet25.AutoFilterMode = False
    Sheet25.Range("M3:M105").EntireRow.AutoFit
    Sheet25.Range("O3:o105").AutoFilter 1, "1", , , False
    Sheets(Array("P3.5 Shift Notes", "TH Board Summary")).PrintOut
    Application.ScreenUpdating = True
    End Sub


    Sub PrintASY_Update()
    Application.ScreenUpdating = False
    Sheet26.AutoFilterMode = False
    Sheet26.Range("M4:M69").EntireRow.AutoFit
    Sheet26.Range("AG4:AG69").AutoFilter 1, "1", , , False
    Sheets(Array("P4 Shift Notes", "TH Board Summary")).PrintOut
    Application.ScreenUpdating = True
    End Sub

    All they do is filter for lines with data in them on the notes sheets and then print them. The stack of printed reports on my desk tells me that the macros function. I just cannot for the life of me figure out why it insists on returning to Sheet25 when the ScreenUpdating is turned back on.
    Last edited by Apokolipse; 12-29-2021 at 12:47 PM. Reason: Visual Clarity

  2. #2
    Registered User
    Join Date
    03-26-2021
    Location
    Birmingham, Alabama
    MS-Off Ver
    Office 2016
    Posts
    7

    Re: Application.ScreenUpdating Switching Worksheet

    Scratch that- Only the first one returns to a different sheet. The other two stay on the sheet that the button lives on.

  3. #3
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,901

    Re: Application.ScreenUpdating Switching Worksheet

    Have you tried simply adding a line to activate the button sheet at the end?
    Rory

  4. #4
    Registered User
    Join Date
    03-26-2021
    Location
    Birmingham, Alabama
    MS-Off Ver
    Office 2016
    Posts
    7

    Re: Application.ScreenUpdating Switching Worksheet

    Yeah, I did that after I posted.
    Sub PrintAll_Update()

    Application.ScreenUpdating = False

    Sheet25.AutoFilterMode = False
    Sheet25.Range("M3:M105").EntireRow.AutoFit
    Sheet25.Range("O3:o105").AutoFilter 1, "1", , , False

    Sheet26.AutoFilterMode = False
    Sheet26.Range("M4:M69").EntireRow.AutoFit
    Sheet26.Range("AG4:AG69").AutoFilter 1, "1", , , False

    Sheets(Array("P3.5 Shift Notes", "TH Board Summary")).PrintOut
    Sheets(Array("P4 Shift Notes")).PrintOut

    Application.ScreenUpdating = True
    Sheet30.Activate

    End Sub
    It really makes me curious as to why though. They all end the same, but only one it weird.

  5. #5
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,203

    Re: Application.ScreenUpdating Switching Worksheet

    I am convinced that this has to do with the grouping of sheets for printing in line:
    Please Login or Register  to view this content.
    It is possible that you have the programmed Activate or Deactivate event of one of the grouped sheets.
    I think disabling events while issuing the print command should help:
    Please Login or Register  to view this content.
    Artik

+ 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] Application.EnableEvents and Application.ScreenUpdating doubt
    By no_Fate in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-04-2017, 01:18 PM
  2. [SOLVED] VBA Application.EnableEvents and Application.ScreenUpdating
    By mcmunoz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-01-2013, 10:24 PM
  3. Application.ScreenUpdating not working with Application.Run
    By WaqasTariq in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-18-2012, 02:24 PM
  4. [SOLVED] Application.screenupdating
    By teachMeExcel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2012, 04:26 PM
  5. Application.ScreenUpdating
    By royUK in forum Tips and Tutorials
    Replies: 3
    Last Post: 05-13-2008, 04:18 AM
  6. Application.ScreenUpdating is ineffective
    By Ken McLennan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-10-2006, 08:35 AM
  7. PLEASE PLEASE HELP Application.Screenupdating
    By modjoe23 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-03-2005, 01:05 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