I am extremelly new to VBA but relatively competant at googling and figuring it out.
I have manage to put this code together for a file I run constantly but it is fairly slow. I know I am not doing things in the best way but if anyone has some ideas for speeding some of the more repetative actions up I would appreciate it!
I have manage to put this code together for a file I run constantly but it is fairly slow. I know I am not doing things in the best way but if anyone has some ideas for speeding some of the more repetative actions up I would appreciate it!
Sub UpdateDD()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim fd As FileDialog, lRow As Long, vSelectedItem As Variant, srcWB As Workbook, desWB As Workbook, ws As Worksheet, FileName As Variant
Set desWB = ThisWorkbook
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.AllowMultiSelect = True
If .Show = -1 Then
For Each vSelectedItem In .SelectedItems
Set srcWB = Workbooks.Open(vSelectedItem)
Sheets.Copy after:=desWB.Sheets(desWB.Sheets.Count)
srcWB.Close False
Next
Else
End If
End With
On Error Resume Next
For Each ws In ActiveWorkbook.Worksheets
If ws.Name Like "Pace Demand*" Then
ws.Select
ActiveSheet.Name = "Demand"
Exit For
End If
Next ws
Worksheets("Redemption Rooms on the Books R").Cells.Copy Worksheets("Redemptions").Cells
Worksheets("Pick Up Report - Business Type").Cells.Copy Worksheets("Group Pickup").Cells
Worksheets("Pick Up Report - Business View").Cells.Copy Worksheets("Segments").Cells
Worksheets("Property (2)").Cells.Copy Worksheets("Property").Cells
Worksheets("Current").Cells.Copy Worksheets("TMTP").Cells
Worksheets("Demand").Cells.Copy Worksheets("Pace").Cells
Sheets("Pick Up Report - Business Type").Delete
Sheets("Pick Up Report - Business View").Delete
Sheets("Redemption Rooms on the Books R").Delete
Sheets("Property (2)").Delete
Sheets("Summary").Delete
Sheets("Previous").Delete
Sheets("Current").Delete
Sheets("Demand").Delete
Sheets("Top SRPs by MCAT").Delete
Sheets("Top Accounts Summary").Delete
For Each ws In ActiveWorkbook.Worksheets
If ws.Name Like "Page*" Then
ws.Select
ActiveSheet.Name = Range("A1")
End If
Next ws
Sheets("Property").Visible = False
Sheets("Segments").Visible = False
Sheets("Group Pickup").Visible = False
Sheets("Pace").Visible = False
Sheets("TMTP").Visible = False
Sheets("Redemptions").Visible = False
ActiveWorkbook.RefreshAll
Sheets("Daily Detail").Select
Range("B12").Select
Application.DisplayAlerts = True
Application.ScreenUpdating = True
ThisFile = Sheets("Daily Detail").Range("B3") & " Daily Detail " & Format(Date, "mm.dd.yyyy") & ".xlsm"
FileName = Application.GetSaveAsFilename(ThisFile, _
"Excel files,*.xlsm", 1, "Select your folder and filename")
If TypeName(FileName) = "Boolean" Then Exit Sub
ActiveWorkbook.SaveAs FileName
End Sub