+ Reply to Thread
Results 1 to 6 of 6

Macro to add sheet, name it based on previous sheet, and delete a range of cells

  1. #1
    Registered User
    Join Date
    10-14-2011
    Location
    Dallas, TX, USA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Question Macro to add sheet, name it based on previous sheet, and delete a range of cells

    I have absolutely no experience in VBA code and cannot figure out how to record a macro to do what I need it to do.

    I have a workbook that has sheet names "Day 1", “Day 2" etc. in which a person fills out each day of the job. In it there are daily costs for a list of vendors. This form is set up so that when a sheet is copied, it keeps a cumulative of cost associated with the vendor. I need some help writing code that will automatically copy the last sheet, rename the sheet Day (x), x being the last day in the workbook +1, and also fills (x) into the cell F15. Then deletes the cost in the Daily cost column (range F47:F76).

    Please see attachment EXAMPLE.

    Any help would be appreciated.
    Attached Files Attached Files
    Last edited by Moeshell; 10-24-2011 at 03:26 PM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to add sheet, name it based on previous sheet, and delete a range of cells

    This is easy and can be done. I will have something for you today.

  3. #3
    Registered User
    Join Date
    10-14-2011
    Location
    Dallas, TX, USA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Macro to add sheet, name it based on previous sheet, and delete a range of cells


    Can anyone help?

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to add sheet, name it based on previous sheet, and delete a range of cells

    Oops. will have something for you soon.

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to add sheet, name it based on previous sheet, and delete a range of cells

    Copy the below code to a blank module in your workbook.

    Please Login or Register  to view this content.
    You can assign a button to get it to work on a single click.

  6. #6
    Registered User
    Join Date
    10-14-2011
    Location
    Dallas, TX, USA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Macro to add sheet, name it based on previous sheet, and delete a range of cells

    Awesome that works like a charm.
    Thanks for your help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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