Sub ExportSheet()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim Folder As String
Dim locationname As String
Dim Response, pw
Dim NewLogRow As Long
Dim formula As String
Dim NameValue As String
Dim FinalName As String
Dim XXX As String
XXX = Format(Date, "[$-409]yyyymmdd;@")
locationname = Sheets("Budget").Range("A3").Value
Folder = "C:\Users\tphythian\Documents\Cost Tracking Exports"
Worksheets("Budget").Visible = True
Sheets(Array("Summary", "Budget", "Transaction Log")).Copy
'Sheets("Budget").Copy
With ActiveSheet.UsedRange
.Value = .Value
End With
With ActiveWorkbook
.SaveAs Folder & "\" & locationname & " - " & XXX & " - Export" & ".xlsx"
.Close
End With
MsgBox "Sheet has been exported and saved in " & "Cost Tracking Exports" & " folder!"
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
[\code]
Option Explicit
Sub ExportSheet()
Dim Folder As String
Dim LocationName As String
Dim XXX As String
Dim wb As Workbook
Application.ScreenUpdating = False
Application.DisplayAlerts = False
With ThisWorkbook
XXX = Format(Date, "[$-409]yyyymmdd;@")
LocationName = .Worksheets("Budget").Range("A3").Value
Folder = ThisWorkbook.Path ' "C:\Users\tphythian\Documents\Cost Tracking Exports"
.Worksheets("Budget").Visible = True
.Worksheets(Array("Summary", "Budget", "Transaction Log")).Copy
Set wb = ActiveWorkbook
End With
With wb
.ActiveSheet.UsedRange.Value = .ActiveSheet.UsedRange.Value
'Debug.Print wb.ActiveSheet.Parent.Name
.Worksheets("Transaction Log").Visible = xlSheetVeryHidden
.SaveAs Folder & "\" & LocationName & " - " & XXX & " - Export" & ".xls" ' ".xlsx"
.Close
End With
Application.ScreenUpdating = True
Application.DisplayAlerts = True
MsgBox "Sheet has been exported and saved in " & "Cost Tracking Exports" & " folder!"
End Sub