+ Reply to Thread
Results 1 to 66 of 66

Need VBA to create new Workbook and name it based on cell value in original file

Hybrid View

YukonSoDank Need VBA to create new... 04-07-2019, 03:40 PM
Mumps1 Re: Need VBA to create new... 04-07-2019, 04:09 PM
YukonSoDank Re: Need VBA to create new... 04-07-2019, 04:21 PM
YukonSoDank Re: Need VBA to create new... 04-07-2019, 04:36 PM
Mumps1 Re: Need VBA to create new... 04-07-2019, 04:44 PM
YukonSoDank Re: Need VBA to create new... 04-07-2019, 05:01 PM
Mumps1 Re: Need VBA to create new... 04-09-2019, 09:28 AM
YukonSoDank Re: Need VBA to create new... 04-09-2019, 12:30 PM
Mumps1 Re: Need VBA to create new... 04-09-2019, 12:38 PM
YukonSoDank Re: Need VBA to create new... 04-09-2019, 01:03 PM
Mumps1 Re: Need VBA to create new... 04-09-2019, 01:07 PM
YukonSoDank Re: Need VBA to create new... 04-09-2019, 02:32 PM
YukonSoDank Re: Need VBA to create new... 04-09-2019, 07:54 PM
Mumps1 Re: Need VBA to create new... 04-10-2019, 10:32 AM
YukonSoDank Re: Need VBA to create new... 04-13-2019, 11:28 AM
Mumps1 Re: Need VBA to create new... 04-13-2019, 03:10 PM
YukonSoDank Re: Need VBA to create new... 05-08-2019, 07:37 AM
Mumps1 Re: Need VBA to create new... 05-08-2019, 09:12 AM
YukonSoDank Re: Need VBA to create new... 05-08-2019, 09:29 AM
Mumps1 Re: Need VBA to create new... 05-08-2019, 09:56 AM
YukonSoDank Re: Need VBA to create new... 05-08-2019, 10:07 AM
Mumps1 Re: Need VBA to create new... 05-08-2019, 10:16 AM
YukonSoDank Re: Need VBA to create new... 05-08-2019, 10:23 AM
Mumps1 Re: Need VBA to create new... 05-08-2019, 10:32 AM
YukonSoDank Re: Need VBA to create new... 05-08-2019, 01:09 PM
Mumps1 Re: Need VBA to create new... 05-08-2019, 03:10 PM
YukonSoDank Re: Need VBA to create new... 05-08-2019, 03:13 PM
Mumps1 Re: Need VBA to create new... 05-08-2019, 03:20 PM
YukonSoDank Re: Need VBA to create new... 05-08-2019, 08:31 PM
Mumps1 Re: Need VBA to create new... 05-09-2019, 08:13 AM
YukonSoDank Re: Need VBA to create new... 05-09-2019, 11:24 AM
Mumps1 Re: Need VBA to create new... 05-09-2019, 11:35 AM
YukonSoDank Re: Need VBA to create new... 05-09-2019, 08:59 PM
Mumps1 Re: Need VBA to create new... 05-10-2019, 08:32 AM
YukonSoDank Re: Need VBA to create new... 05-10-2019, 09:13 AM
Mumps1 Re: Need VBA to create new... 05-10-2019, 01:22 PM
YukonSoDank Re: Need VBA to create new... 05-13-2019, 07:25 PM
Mumps1 Re: Need VBA to create new... 05-14-2019, 10:11 AM
YukonSoDank Re: Need VBA to create new... 05-14-2019, 09:13 PM
Mumps1 Re: Need VBA to create new... 05-15-2019, 11:07 AM
YukonSoDank Re: Need VBA to create new... 05-30-2019, 10:24 AM
Mumps1 Re: Need VBA to create new... 05-30-2019, 11:43 AM
YukonSoDank Re: Need VBA to create new... 05-30-2019, 12:34 PM
Mumps1 Re: Need VBA to create new... 05-30-2019, 01:06 PM
YukonSoDank Re: Need VBA to create new... 05-30-2019, 01:44 PM
Mumps1 Re: Need VBA to create new... 05-31-2019, 09:37 AM
YukonSoDank Re: Need VBA to create new... 05-31-2019, 09:45 AM
Mumps1 Re: Need VBA to create new... 05-31-2019, 11:39 AM
YukonSoDank Re: Need VBA to create new... 05-31-2019, 01:15 PM
Mumps1 Re: Need VBA to create new... 05-31-2019, 02:25 PM
YukonSoDank Re: Need VBA to create new... 05-31-2019, 02:53 PM
Mumps1 Re: Need VBA to create new... 06-01-2019, 12:33 PM
YukonSoDank Re: Need VBA to create new... 06-01-2019, 03:28 PM
Mumps1 Re: Need VBA to create new... 06-02-2019, 07:49 AM
YukonSoDank Re: Need VBA to create new... 06-02-2019, 09:23 AM
Mumps1 Re: Need VBA to create new... 06-03-2019, 09:59 AM
YukonSoDank Re: Need VBA to create new... 06-08-2019, 02:47 PM
  1. #1
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,026

    Re: Need VBA to create new Workbook and name it based on cell value in original file

    Try:
    Sub CopyDataAndSave()
        Application.ScreenUpdating = False
        Dim desWB As Workbook, desWS As Worksheet, srcWS1 As Worksheet, srcWS2 As Worksheet
        Set srcWS1 = ThisWorkbook.Sheets("Detailed Outputs")
        Set srcWS2 = ThisWorkbook.Sheets("User Inputs")
        Set desWB = Workbooks.Open(Environ("userprofile") & "\Desktop\Upwork\Model_Template.xlsx")
        Set desWS = Sheets("Input")
        With srcWS1
            .Range("B8:M8").Copy
            desWS.Range("Q4").PasteSpecial xlPasteValues
            .Range("B45:M45 ").Copy
            desWS.Range("Q8").PasteSpecial xlPasteValues
            Application.CutCopyMode = False
        End With
        ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path & Application.PathSeparator & srcWS2.Range("C14").Value & ".xlsx", FileFormat:=51
        Application.ScreenUpdating = True
    End Sub
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  2. #2
    Registered User
    Join Date
    04-02-2019
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    74

    Re: Need VBA to create new Workbook and name it based on cell value in original file

    Awesome! It seems to work perfectly, many thanks again.

    My one long term concern is giving access to these files to others for their use. I'm assuming a new user would need to alter the des path in order for it work. I would have the template tabs in the "VDER" file so they could be copied via the macro, but it is a protected file. Any thoughts on this? I guess a new user would need to save both files in the same folder and then change the des file path.

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,026

    Re: Need VBA to create new Workbook and name it based on cell value in original file

    You could have a file picker window pop up where the user selects the folder and the file to open. Would that work for you? What do you mean by "it is a protected file"?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 10-17-2018, 02:35 AM
  2. [SOLVED] Need to modify macro to also create backup of original file
    By tfilipe in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-15-2018, 03:25 PM
  3. open worksheet in a different workbook based on cell name in original workbook
    By thara95 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-03-2017, 07:38 AM
  4. VBA that works perfectly in one file errors out in a new file based off the original!
    By carthesis in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-09-2016, 07:24 AM
  5. Replies: 1
    Last Post: 07-17-2014, 12:06 PM
  6. Splitting Excel file but want to create data links to original
    By hitchy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-10-2013, 11:46 AM
  7. Trying to create a 2nd workbook to mirror the first, to protect the original
    By zachdking in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-06-2013, 08:11 PM

Tags for this Thread

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