Hello all,
I have a macro that saves me my excel workbook, in a specific location, with a name from a specific cell.
The problems i have right now is this:
- i don't want the macro to save the entire sheet 1, only A1:V100
This is the code i have right now:
Sub SaveAs()
Dim FName As String
Dim FPath As String
Dim NewBook As Workbook
FPath = "C:\Users\user\Desktop\test"
'U5 = cell with date
FName = Format(Range("U5"), "YYMMDD")
Set NewBook = Workbooks.Add
ThisWorkbook.Sheets("Delivery").Copy Before:=NewBook.Sheets(1)
If Dir(FPath & "\" & FName) <> "" Then
MsgBox "File " & FPath & "\" & FName & " already exists"
Else
NewBook.SaveAs filename:=FPath & "\" & FName
End If
Workbooks(FName).Close SaveChanges:=True
End Sub
Thank you!
Bookmarks