Results 1 to 6 of 6

Macro to skip duplicates

Threaded View

  1. #1
    Registered User
    Join Date
    04-15-2014
    Location
    Washington, USA
    MS-Off Ver
    Excel 2003
    Posts
    12

    Macro to skip duplicates

    I have a macro that allows me to generate worksheets based on a range of cells, however if the range includes a duplicate it throws an error.
    I also need to solve the problem of adding new data to the range and allowing the macro to skip over cells where a worksheet already exists and only create new worksheets for new and unique cells content.

    Any ideas would be helpful.

    Here is the current Macro and I am attaching a sample.


    Sub Generate_worksheets()
        
     
      Dim ws1 As Worksheet
        
        Set ws1 = ThisWorkbook.Worksheets("Master")
    
        Dim MyCell As Range, MyRange As Range
    
        Set MyRange = Sheets("Select").Range("A5")
        Set MyRange = Range(MyRange, MyRange.End(xlDown))
        Sheets("Master").Visible = True
        Sheets("End").Visible = False
        For Each MyCell In MyRange
           ws1.Copy ThisWorkbook.Sheets(Sheets.Count)
          
           ThisWorkbook.Worksheets("Master (2)").Name = MyCell.Value
           
        With ActiveSheet
        .Range("B3").Value = .Name
        End With
       
       
       Next MyCell
            
            Sheets("Master").Visible = False
            Sheets("End").Visible = True
        
        MsgBox "Done!"
    
    End Sub
    Thanks in advance,
    Matt
    Attached Files Attached Files
    Last edited by Leith Ross; 04-16-2014 at 03:27 PM. Reason: Added Code Tags

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 find duplicates, concatenate Unique Values, then delete old duplicates
    By lesoies in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-17-2013, 04:32 PM
  2. [SOLVED] Transfer cell values to another sheet, but need to skip duplicates
    By VBA FTW in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-04-2012, 06:20 PM
  3. Skip Duplicates
    By zit1343 in forum Excel General
    Replies: 5
    Last Post: 08-09-2011, 01:40 PM
  4. Count and select outcomes, skip duplicates
    By roberto1111 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-27-2009, 09:38 PM
  5. [SOLVED] Count Duplicates in a range - skip blanks
    By jhahes in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-08-2006, 04:50 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