Results 1 to 17 of 17

Can't turn autocalculate back on.

Threaded View

  1. #1
    Registered User
    Join Date
    06-27-2012
    Location
    Indianapolis, IN
    MS-Off Ver
    Excel 2010
    Posts
    8

    Can't turn autocalculate back on.

    Hi guys, I am really new to vba. I managed to piece together the below macro but I can't seem to get autocalculate to turn back on and would appreciate some help.
    Sub testing()
    Application.Calculation = xlCalculationManual
    Dim FilesToOpen
       Dim x As Integer
       On Error GoTo ErrHandler
       Application.ScreenUpdating = False
       FilesToOpen = Application.GetOpenFilename _
         (FileFilter:="Microsoft Excel Files (*.xls), *.xls", _
         MultiSelect:=True, Title:="Select Short Term")
    
       If TypeName(FilesToOpen) = "Boolean" Then
           MsgBox "No Files were selected"
           GoTo ExitHandler
       End If
      x = 1
      Dim wkb As Workbook
      Dim wks As Worksheet
      Application.DisplayAlerts = False
      While x <= UBound(FilesToOpen)
          Set wkb = Workbooks.Open(FilesToOpen(x))
          On Error Resume Next
          On Error GoTo ErrHandler
          Cells.Copy
            ThisWorkbook.Activate
            Sheets("Short Term").Activate
            Range("A1").Select
            ActiveSheet.Paste
             wkb.Close False
          x = x + 1
      Wend
      Application.DisplayAlerts = True
    
       FilesToOpen = Application.GetOpenFilename _
         (FileFilter:="Microsoft Excel Files (*.xls), *.xls", _
         MultiSelect:=True, Title:="Select Term")
       If TypeName(FilesToOpen) = "Boolean" Then
           MsgBox "No Files were selected"
           GoTo ExitHandler
       End If
      x = 1
        Application.DisplayAlerts = False
      While x <= UBound(FilesToOpen)
          Set wkb = Workbooks.Open(FilesToOpen(x))
          On Error Resume Next
          On Error GoTo ErrHandler
          Cells.Copy
            ThisWorkbook.Activate
            Sheets("term").Activate
            Range("A1").Select
            ActiveSheet.Paste
             wkb.Close False
          x = x + 1
      Wend
      Application.DisplayAlerts = True
       FilesToOpen = Application.GetOpenFilename _
         (FileFilter:="Microsoft Excel Files (*.xls), *.xls", _
         MultiSelect:=True, Title:="Select GSE-TLGP")
       If TypeName(FilesToOpen) = "Boolean" Then
           MsgBox "No Files were selected"
           GoTo ExitHandler
       End If
      x = 1
        Application.DisplayAlerts = False
      While x <= UBound(FilesToOpen)
          Set wkb = Workbooks.Open(FilesToOpen(x))
          On Error Resume Next
          On Error GoTo ErrHandler
          Cells.Copy
            ThisWorkbook.Activate
            Sheets("GSE-TLGP").Activate
            Range("A1").Select
            ActiveSheet.Paste
             wkb.Close False
          x = x + 1
          Wend
    rename
    
    Application.DisplayAlerts = True
    ExitHandler:
    
       Application.ScreenUpdating = True
       Exit Sub
    ErrHandler:
       MsgBox Err.Description
       Resume ExitHandler
    
         On Error GoTo ErrHandler
    
    
    End Sub
    Last edited by thinlizzy; 06-27-2012 at 05:21 PM. Reason: code tags

Thread Information

Users Browsing this Thread

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

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