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
Bookmarks