Consulting

Results 1 to 3 of 3

Thread: Copy certain worksheets from one workbook to another while keeping format

  1. #1
    VBAX Regular
    Joined
    Dec 2017
    Posts
    17
    Location

    Copy certain worksheets from one workbook to another while keeping format

    Hi,
    Could anybody please help, I have a workbook that generates invoices through a macro and I need these generated invoices to be copied and saved to a new workbook.
    I would like the formatting to remain and a msgbox to let me rename the new workbook.
    Also, would it be possible to omit 4 worksheets that are permanently in the source workbook (these sheets are not in consecutive order)

    Any ideas would be greatly appreciated
    Thanks

  2. #2
    VBAX Regular
    Joined
    Jan 2018
    Posts
    55
    Location
    Something like this?

    Sub test()
        Dim fName
        Application.DisplayAlerts = False
        Sheets("temp1").Delete
        Sheets("temp2").Delete
        Sheets("temp3").Delete
        Sheets("temp4").Delete
        fName = Application.GetSaveAsFilename
        If fName <> False Then ThisWorkbook.SaveAs Filename:=fName
    End Sub

  3. #3
    VBAX Regular
    Joined
    Dec 2017
    Posts
    17
    Location
    Quote Originally Posted by yujin View Post
    Something like this?

    Sub test()
        Dim fName
        Application.DisplayAlerts = False
        Sheets("temp1").Delete
        Sheets("temp2").Delete
        Sheets("temp3").Delete
        Sheets("temp4").Delete
        fName = Application.GetSaveAsFilename
        If fName <> False Then ThisWorkbook.SaveAs Filename:=fName
    End Sub
    Thanks yujin it worked fine

Posting Permissions

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