Results 1 to 8 of 8

Save a part of the file with a specific name

Threaded View

  1. #1
    Registered User
    Join Date
    01-15-2017
    Location
    Europe
    MS-Off Ver
    2016
    Posts
    43

    Save a part of the file with a specific name

    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!
    Last edited by julius2017; 10-26-2017 at 04:22 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Save PDF to users desktop and use value of specific cell in part of the name
    By Maike in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-20-2017, 04:33 PM
  2. [SOLVED] Macro to manually choose PDF file and save it to a specific location with specific name
    By tnuis in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-18-2014, 07:47 AM
  3. Replies: 1
    Last Post: 10-25-2013, 12:49 AM
  4. Replies: 0
    Last Post: 07-11-2013, 02:08 AM
  5. Want to save a file with part of the name derived from an inputbox
    By camcrazy08 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2007, 04:24 PM
  6. Save file using part of folder name
    By Object in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-30-2006, 11:25 PM
  7. [SOLVED] reading a range name as part of Save-as file
    By excelnut1954 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-27-2005, 01:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1