+ Reply to Thread
Results 1 to 3 of 3

copy sheets without shapes?

Hybrid View

  1. #1
    Registered User
    Join Date
    11-26-2015
    Location
    Warminster, UK
    MS-Off Ver
    2016
    Posts
    6

    copy sheets without shapes?

    Hi Quite new to coding but learning all the time.

    I have a problem and would like some help. I'd like to copy 8 sheets from a workbook, create a new workbook, name the workbook from an input box, paste the copied sheets, remove the created sheet 1 from the new workbook, remove the textboxes/shapes, un show gridlines, un show headings, save the workbook with the input box text, close the workbook and return to the original workbook.

    I have this so far,

    fName = InputBox("Week Beginning")
        fName = "C:\Users\Sammi\Documents\Weekly_Banking_" & fName
        Set wB = Workbooks.Add
        ThisWorkbook.Activate
        Sheets(Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "BankingSummary")).Copy Before:=wB.Sheets(1)
        wB.Activate
        ActiveWorkbook.Sheets("Sheet1").Delete
        ActiveWorkbook.Sheets(Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "BankingSummary")).Shapes.Delete
        wB.SaveAs Filename:=fName
    also new to here so if I've posted this wrong then sorry :/

  2. #2
    Registered User
    Join Date
    11-26-2015
    Location
    Gloucester, England
    MS-Off Ver
    2007
    Posts
    11

    Re: copy sheets without shapes?

    I would go looking for "collection" in Help - I have used them to find specific objects and deal with them. Can't remember the syntax but shapes were one of the things I was dealing with.
    My take would be to always copy everything then remove what you don't want. Safer that way.

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: copy sheets without shapes?

    Try the following (not tested)
    Sub Test()
        Dim fName As String, WB As Workbook
        fName = InputBox("Week Beginning")
        fName = "C:\Users\Sammi\Documents\Weekly_Banking_" & fName
        Set WB = Workbooks.Add
        
        Application.CopyObjectsWithCells = False
        Application.DisplayAlerts = False
        
            Sheets(Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "BankingSummary")).Copy Before:=WB.Sheets(1)
            ActiveWorkbook.Sheets("Sheet1").Delete
            WB.SaveAs Filename:=fName
            
        Application.DisplayAlerts = True
        Application.CopyObjectsWithCells = True
    End Sub
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

+ 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. [SOLVED] Looping Sheets to change Color of Shapes
    By Hood in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-16-2015, 02:47 PM
  2. Copy and paste text in shapes to different worksheet
    By seabass in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-22-2010, 09:37 AM
  3. Shapes in Sheets
    By ggayathri in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-17-2010, 03:40 AM
  4. Copy shapes in excel 2007
    By bvdven in forum Excel General
    Replies: 3
    Last Post: 02-25-2010, 07:28 AM
  5. How To Move Shapes From Another Shapes? (floating shapes)
    By MarcLev in forum Word Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2009, 04:04 PM
  6. Shapes don't copy to new workbook
    By mrdata in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-04-2007, 04:11 PM
  7. copy sheet without changing name of shapes
    By ittekinomizu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-12-2007, 07:57 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