+ Reply to Thread
Results 1 to 13 of 13

VBA Copy worksheet in a workbook to new workbook

  1. #1
    Forum Contributor
    Join Date
    09-21-2015
    Location
    nederland
    MS-Off Ver
    2021
    Posts
    206

    VBA Copy worksheet in a workbook to new workbook

    Dear all,

    I'd appreciate any help on how to copy 2 worksheet in a workbook : ID Data en Information
    to new workbook and save them in to map the name value on sheets Menu range B3 en the file name on range B4
    after copy add them as attachment on email ( I use outlook 2016)

    see attachment excel file

    Thanks
    Attached Files Attached Files
    Last edited by kirana2014; 10-19-2017 at 12:09 PM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: VBA Copy worksheet in a workbook to new workbook

    Here's the basic code.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    09-21-2015
    Location
    nederland
    MS-Off Ver
    2021
    Posts
    206

    Re: VBA Copy worksheet in a workbook to new workbook

    Hi Norie,

    Thank you for your quick response , I still get error message " The file name or path does not exist"
    Dou you know how to make VBA if path not exit must be creat bij vba ?

    I use below but not work please help

    If Not IsFolderExixts(myFolder) Then
    CreateObject("Scripting.FileSystemObject").CreateFolder myFolder
    End If

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: VBA Copy worksheet in a workbook to new workbook

    In your workbook you had 'C\Database' in D3, that's not valid path.

    By the way, the code I posted was missing a part - specifying the format of the new workbook, I've added that below so the new workbook saves as a macro-free workbook.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    09-21-2015
    Location
    nederland
    MS-Off Ver
    2021
    Posts
    206

    Re: VBA Copy worksheet in a workbook to new workbook

    Hi Norie,

    my mistake that was

    C:\Database

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: VBA Copy worksheet in a workbook to new workbook

    Try this.
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    09-21-2015
    Location
    nederland
    MS-Off Ver
    2021
    Posts
    206

    Re: VBA Copy worksheet in a workbook to new workbook

    Hi Norie,

    Working good, one more question it's possible to add

    to : "roni123@gmail.com
    cc : " "
    Bcc : " "
    Subject : Range("A1") on Menu

    Thanks again for your help

    Kirana

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: VBA Copy worksheet in a workbook to new workbook

    Is it always the same email address or will that come from the 'Menu' sheet too?

  9. #9
    Forum Contributor
    Join Date
    09-21-2015
    Location
    nederland
    MS-Off Ver
    2021
    Posts
    206

    Re: VBA Copy worksheet in a workbook to new workbook

    Please add from menu

    To : range A6
    Cc : range A7
    Bcc : range A8

    Subject : range A1


    Thank for your time and help
    Kirana

  10. #10
    Forum Contributor
    Join Date
    09-21-2015
    Location
    nederland
    MS-Off Ver
    2021
    Posts
    206

    Re: VBA Copy worksheet in a workbook to new workbook

    Hi Norie

    Please help !

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: VBA Copy worksheet in a workbook to new workbook

    Kirana

    I'm kind of busy right now but I'll post later.

  12. #12
    Forum Contributor
    Join Date
    09-21-2015
    Location
    nederland
    MS-Off Ver
    2021
    Posts
    206

    Re: VBA Copy worksheet in a workbook to new workbook

    Ok thanks no problem

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: VBA Copy worksheet in a workbook to new workbook

    Kirana

    Here you are, sorry about the delay.
    Please Login or Register  to view this content.

+ 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. Open 2nd workbook find matching worksheet names and copy values to 1st workbook
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-09-2017, 10:22 AM
  2. Copy Worksheet Values/Formatting from closed workbook to open workbook
    By pchalk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-03-2016, 11:30 AM
  3. Replies: 5
    Last Post: 09-25-2015, 10:32 AM
  4. [SOLVED] Copy a Worksheet from a Closed Workbook to the Current Opened Workbook
    By glennchung in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-28-2014, 12:55 PM
  5. Copy worksheet from closed workbook into active/existing workbook.
    By rasikvekaria in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2012, 06:55 AM
  6. Copy multiple worksheets from 2003 workbook to one worksheet in 2010 workbook
    By KeithRoberts in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-06-2012, 10:18 AM
  7. copy values from a worksheet to another workbook. source workbook name unknown
    By sark666 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-12-2009, 11:05 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