+ Reply to Thread
Results 1 to 2 of 2

Vba to add new worksheet when range changes.

Hybrid View

templedream Vba to add new worksheet when... 07-16-2014, 03:53 PM
alansidman Re: Vba to add new worksheet... 07-16-2014, 04:08 PM
  1. #1
    Registered User
    Join Date
    06-09-2014
    Posts
    1

    Unhappy Vba to add new worksheet when range changes.

    I am a bit familiar with macros but I am struggling. I have a code that copy a template and rename based on a range in a sheet call master.
    However, I want to update it such that when new names excluding empty cells are included in the range, automatically searches all the worksheets and the create a new template and rename based the cell value.

    Below is the code
    Sub ReName()
        Dim c As Range
        Set Sh = Sheets("Template")
        
        Application.ScreenUpdating = False
        With Sheets("Template")
            For Each c In .[EN]
                If c.Value <> "" Then
                Sheets("Master").Cells.Copy
                    .Copy After:=Sheets(Sheets.Count)
                    On Error Resume Next
                    ActiveSheet.Name = c.Value
                    On Error GoTo 0
                End If
            Next c
        End With
        Application.ScreenUpdating = True
    End Sub
    Last edited by templedream; 07-17-2014 at 08:22 AM. Reason: code tags added

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,785

    Re: Vba to add new worksheet when range changes.

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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. VBA Match Cell Range to Worksheet Name and copy/paste to respective worksheet
    By rlsublime in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-24-2014, 04:06 PM
  2. Match Cell Value to Worksheet Name Then Copy/ Paste Range to Worksheet
    By matt2072 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-31-2014, 01:23 PM
  3. Replies: 3
    Last Post: 09-08-2013, 06:38 PM
  4. Copy text from set range in one worksheet to named worksheet in another workbook
    By Steven811 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2013, 10:55 AM
  5. Range Question / error 1004: method Range of object Worksheet has failed
    By Paul in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-07-2005, 10:06 AM

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