sanantonio
Board Regular
- Joined
- Oct 26, 2021
- Messages
- 124
- Office Version
- 365
- Platform
- Windows
Hi All,
Wondering if I could illicit some help from your good folks.
Is my code.
What I'm after it doing is:
1). Not saving the active sheet, but saving a sheet called "Comparison"
2). It currently only saves to the filepath where the macro workbook is saved but need to save it to a specific other location. I've tried putting that location into this line: Application.ActiveWorkbook.SaveAs Filename:=xPath & "\" but it just gives me an error.
Would really appreciate a little insight! Thanks in advance.
Wondering if I could illicit some help from your good folks.
VBA Code:
Sub SveShts()
Dim xPath As String
Dim xWs As String
xPath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
With ActiveSheet
ActiveSheet.Copy
Application.ActiveWorkbook.SaveAs Filename:=xPath & "\" & ActiveSheet.Name & " " & Range("Q2").Value & " " & Range("Q5").Value & ".xlsx"
Application.ActiveWorkbook.Close False
End With
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Is my code.
What I'm after it doing is:
1). Not saving the active sheet, but saving a sheet called "Comparison"
2). It currently only saves to the filepath where the macro workbook is saved but need to save it to a specific other location. I've tried putting that location into this line: Application.ActiveWorkbook.SaveAs Filename:=xPath & "\" but it just gives me an error.
Would really appreciate a little insight! Thanks in advance.