Guest User

Untitled

a guest
May 24th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. Application.ScreenUpdating = False
  2. Application.AskToUpdateLinks = False
  3. Application.DisplayAlerts = False
  4.  
  5.  
  6. With Application.FileDialog(msoFileDialogFilePicker)
  7.  
  8. .Title = "Please select a folder"
  9.  
  10. .Show
  11.  
  12. .AllowMultiSelect = False
  13. If .SelectedItems.Count = 0 Then 'If no folder is selected, abort
  14.  
  15. MsgBox "You did not select a folder"
  16.  
  17. Exit Sub
  18.  
  19. End If
  20.  
  21. MyFolder = .SelectedItems(1) & "" 'Assign selected folder to MyFolder
  22.  
  23. End With
  24.  
  25. MyFile = Dir(MyFolder) 'DIR gets the first file of folder
  26.  
  27.  
  28. While MyFile <> ""
  29.  
  30. Set wbk = Workbooks.Open(filename:=MyFolder, UpdateLinks:=False)
  31.  
  32.  
  33. Application.AutomationSecurity = msoAutomationSecurityLow
  34.  
  35. wbk.Activate
  36.  
  37. ws.Select
  38. ws.Copy after:=Workbooks("SCAR_Tool.xlsm").Sheets(6)
  39. ws.Name = "JCAVSPersonnelByEligibilityAndA"
  40. wbk.Close savechanges:=True
  41. Wend
Add Comment
Please, Sign In to add comment