Results 1 to 4 of 4

Copy Sheet, Rename and Delete Values in a Range on New Sheet

Threaded View

Storm08 Copy Sheet, Rename and Delete... 09-14-2022, 11:54 AM
carlmon Re: Copy Sheet, Rename and... 09-14-2022, 03:39 PM
ByteMarks Re: Copy Sheet, Rename and... 09-14-2022, 06:20 PM
Storm08 Re: Copy Sheet, Rename and... 09-15-2022, 04:00 AM
  1. #1
    Forum Contributor
    Join Date
    01-12-2012
    Location
    UK
    MS-Off Ver
    Excel 2016
    Posts
    104

    Copy Sheet, Rename and Delete Values in a Range on New Sheet

    Hi All,

    I'm trying to copy a Worksheet, rename it and then remove the contents (keep formatting) from a range in the duplicate/new sheet.

    I've tried this with the below code, but it removes the contents from the original sheet instead of the new one. What's the best way to do this?

    Private Sub btnDuplicate_Click()
    Dim myRange As Range
    
    Set myRange = Union(Range("B32:AK55"), Range("AP32:AS55"), Range("B108:AK131"), Range("AP108:AS131"), Range("B184:AK207"), Range("AP184:AS207"))
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
        ActiveSheet.Copy After:=Sheets(Sheets.Count)
        On Error Resume Next
        ActiveSheet.Name = Range("E16").Value
        ActiveSheet.myRange.Value = ""
        On Error GoTo 0
    Application.ScreenUpdating = True
    Application.DisplayAlerts = True
    End Sub
    Many thanks!

    Storm
    Last edited by Storm08; 09-15-2022 at 04:01 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 24
    Last Post: 06-26-2020, 08:44 AM
  2. Replies: 0
    Last Post: 02-09-2016, 03:04 PM
  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. Replies: 0
    Last Post: 07-16-2013, 01:20 PM
  6. Copy certain info in one sheet to a new sheet to a different area and rename new sheet
    By Elmarie_Potgieter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-14-2013, 05:34 AM
  7. Replies: 5
    Last Post: 01-25-2012, 12:31 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