Results 1 to 5 of 5

Macro should run without switching sheets

Threaded View

  1. #1
    Registered User
    Join Date
    08-08-2013
    Location
    Colorado, USA
    MS-Off Ver
    365
    Posts
    44

    Macro should run without switching sheets

    I have a macro that calls other macros that go to other tabs, look at the data, then hide some rows. I've tried putting the Application.ScreenUpdating = False command at various places in both the main macro and the macros that are called by the main macro, but no matter what I've tried, when the macro runs, the screen flicks over to those other tabs. Any thoughts? The macros are below. The UPDATEALLSHEETS macro is the first one, which calls the other ones.

    
    Sub UpdateAllSheets()
    
    Application.ScreenUpdating = False
    
        Call VolumeRowUnhideHide
        Call UpdateSpendingAllMfg
        
    Application.ScreenUpdating = True
            
    Sheets("Key Metrics").Select   'This puts the user back to the place they started.
    Range("G4").Select
        
    End Sub
    
    
    Sub VolumeRowUnhideHide()
    
    Application.ScreenUpdating = False
          
    Dim Rwn As Long
    Sheets("Volume").Select
            Range("b6:b28").Select
            Range("b6:b28").EntireRow.Hidden = False
         
            For Rwn = 6 To 28
                If Cells(Rwn, 3) = 0 And Cells(Rwn, 4) = 0 And Cells(Rwn, 5) = 0 Then
                    Cells(Rwn, 3).EntireRow.Hidden = True
                End If
            Next Rwn
        
        Range("B1").Select
          
        Application.ScreenUpdating = True
    
    End Sub
    
    
    Sub UpdateSpendingAllMfg()
        
    Application.ScreenUpdating = False
         
    Dim Rwn As Long
           
    Sheets("Spending - All Mfg").Select
            Range("C9:C22").Select
            Range("C9:C22").EntireRow.Hidden = False
    
            For Rwn = 9 To 22
                If Cells(Rwn, 3) = 0 And Cells(Rwn, 4) = 0 And Cells(Rwn, 5) = 0 Then
                    Cells(Rwn, 3).EntireRow.Hidden = True
                End If
            Next Rwn
        
        Range("B1").Select
          
        Application.ScreenUpdating = True
          
    End Sub
    Last edited by barnett2000; 08-12-2013 at 03:17 PM. Reason: Added code tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 07-26-2013, 01:39 AM
  2. [SOLVED] Refreshing/Recalculating Sheets based on user input or switching between sheets
    By SonOfOdin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-24-2012, 09:48 PM
  3. Stop sheets switching
    By sigfreid in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-13-2009, 07:35 AM
  4. Help on Add-in for switching between sheets
    By muster in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-10-2006, 09:39 AM
  5. Switching between sheets in same window...
    By Kojones in forum Excel General
    Replies: 1
    Last Post: 07-16-2005, 06:05 PM

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