Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Tank()
- Dim wb As Workbook
- Dim myPath As String
- Dim myfile As String
- Dim myExtension As String
- Dim SheetName As String
- 'Optimize Macro Speed
- Application.ScreenUpdating = False
- Application.EnableEvents = False
- Application.Calculation = xlCalculationManual
- SheetName = "Tankard*"
- myPath = "\ph00winfdfs01psharesJoeyCdocumentsRoamingWindowsDesktopTank"
- If myPath = "" Then GoTo ResetSettings
- 'Target File Extension (must include wildcard "*")
- myExtension = "Tankard*.csv"
- 'Target Path with Ending Extention
- myfile = Dir(myPath & myExtension)
- 'Loop through each Excel file in folder
- For i = 1 To 201
- Set wb = Workbooks.Open(Filename:=myPath & myfile)
- ';;;;;;;;;;;;;;WRITE YOUR CODE HERE
- Sheets("SheetName").Select
- Columns("A").Select
- Selection.Delete
- wb.Close SaveChanges:=True
- Next i
- 'Get next file name
- myfile = Dir
- 'Message Box when tasks are completed
- MsgBox "Task Complete!"
- ResetSettings:
- 'Reset Macro Optimization Settings
- Application.EnableEvents = True
- Application.Calculation = xlCalculationAutomatic
- Application.ScreenUpdating = True
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement