+ Reply to Thread
Results 1 to 5 of 5

VBA to copy sheet, move to end and rename to next number in sequence

  1. #1
    Forum Contributor
    Join Date
    07-21-2018
    Location
    London, England
    MS-Off Ver
    Excel for Mac Version 16.15
    Posts
    117

    VBA to copy sheet, move to end and rename to next number in sequence

    Hello!

    I'm fairly new to VBA so any help would be much appreciated.

    I have a worksheet and I want to put a button at the bottom that says 'add next date.' When clicked, I'd like it to copy the sheet and move it to the end and rename it to the next number (date) in the sequence. For example, the first sheet is called '1' and when the button on it is clicked it will duplicate it and rename it '2.'

    Please can anyone help me with this or point me in the right direction of some tutorials that might help?

    Thank you!

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: VBA to copy sheet, move to end and rename to next number in sequence

    To attach to a command button, click Developer|Insert and then select the button from the Form controls tool box. There should be a pop up menu appear when you install the button on the sheet which allows you to attach the macro to the button. The code goes into any one of the numbered code modules.

    Please Login or Register  to view this content.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Forum Contributor
    Join Date
    07-21-2018
    Location
    London, England
    MS-Off Ver
    Excel for Mac Version 16.15
    Posts
    117

    Re: VBA to copy sheet, move to end and rename to next number in sequence

    That's perfect! Thank you so much!

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: VBA to copy sheet, move to end and rename to next number in sequence

    Quote Originally Posted by benjhardie View Post
    That's perfect! Thank you so much!
    You are welcome,
    regards, JLG

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,574

    Re: VBA to copy sheet, move to end and rename to next number in sequence

    JLG.
    Not knocking your code but it fails if you would have a sequence of for instance "Master Sheet", "2", "3" and start copying sheets from there.

+ 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: 2
    Last Post: 01-15-2019, 06:35 PM
  2. Using VBA to Move/copy/rename a tab in Workbook
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-27-2018, 08:07 AM
  3. [SOLVED] Copy a sheet, rename it by value in range then export product to new workbook and rename
    By MagicMan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-31-2015, 07:24 PM
  4. Replies: 0
    Last Post: 06-28-2014, 02:26 PM
  5. Copy sheet and rename based on week number
    By racton in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-13-2011, 09:37 PM
  6. rename & copy *.xls file in the folder then move
    By farrukh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-13-2011, 12:22 PM
  7. [SOLVED] Open a sheet rename and move to another workbook
    By Patrick in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 08-18-2006, 11:30 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