+ Reply to Thread
Results 1 to 7 of 7

Close Workbook And Rename Worksheet

  1. #1
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    139

    Close Workbook And Rename Worksheet

    Hello,
    I got that vba code somwhere in the forum after some little amendment I took it into my work
    The code does the following

    Please Login or Register  to view this content.

    Based on the checkbox marked it opens that workbook copy Sheet1 and rename the copied worksheet with "NewData".


    I want that vba code to close that workbook from where Sheet1 is copied after copying the worksheet.

    I want it to check before copying if there is any worksheet named "NewData" in my active(CAPIProjectManagement.xlsm) workbook.If exists then rename the Sheet named "NewData" into "OldData" (And if there is already sheet named "OldData" then delete it) before copying and give the name "NewData" to newly copied worksheet.


    I tried to do but I couldn't.


    Any help will be appreciated!


    Thank you
    Last edited by Ariff_Chowdhury; 08-03-2013 at 10:13 PM.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Close Workbook And Rename Worksheet

    you can use this code
    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    139

    Re: Close Workbook And Rename Worksheet

    Dear patel45,

    Thank you for your reply and the code. But the above code is not serving my purpose.

    I have a macro button that gives me the list of workbooks (of specified path) and in the next column it creates checkboxes against each workbook when I check on i any checkbox it opens that workbook and copy Sheet1 and rename the copied worksheet with "NewData".After that it doesn't close the workbook from the Sheet1 is copied.I want that vba code to close that workbook from where Sheet1 is copied after copying the worksheet.

    When I run the macro second time it should check the following.
    If there is any worksheet named "OldData" in my activeworkbook then delete that worksheet.
    If there is any worksheet named "NewData" then rename it to "OldData".
    Then it copies the worksheet and name it with "NewData".

  4. #4
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    139

    Re: Close Workbook And Rename Worksheet

    Anyone can help pleasee!

  5. #5
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Close Workbook And Rename Worksheet

    Quote Originally Posted by Ariff_Chowdhury View Post
    I want it to check before copying if there is any worksheet named "NewData" in my active(CAPIProjectManagement.xlsm) workbook.If exists then rename the Sheet named "NewData" into "OldData" (And if there is already sheet named "OldData" then delete it) before copying and give the name "NewData" to newly copied worksheet.
    you wrote it

  6. #6
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    139

    Re: Close Workbook And Rename Worksheet

    Dear patel45,

    Can you please be more specific i do not understand!

    OR

    Is there anyone who can help me out of this pleasee!


    Thank you!

  7. #7
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    139

    Re: Close Workbook And Rename Worksheet

    BUMP - need a response, can someone help me please ?

+ 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] Macro to Rename Worksheet Tab with Workbook File Name
    By sonyap in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-21-2013, 05:00 PM
  2. [SOLVED] Rename tab with date from a cell for each worksheet in the workbook
    By tmeakin! in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2013, 05:23 PM
  3. [SOLVED] To rename a workbook filename with the column value of a worksheet.
    By Vinutha in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-18-2012, 04:29 AM
  4. Replies: 2
    Last Post: 09-04-2012, 01:19 AM
  5. how to close a workbook without saving a individual worksheet?
    By vjarowdy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-28-2007, 05:44 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