+ Reply to Thread
Results 1 to 11 of 11

Cpying Unique entries to new spreadsheet

  1. #1
    Registered User
    Join Date
    02-24-2007
    Posts
    84

    Cpying Unique entries to new spreadsheet

    I'm trying to write a macro to use as an auto-update feature for a spreadsheet.

    I currently use Data validation on an input cell to allow the user to select from a list of product types.

    I'd like the update to affect this list, so new product types are always available to the user.

    However, the list of product types is in another spreadsheet and contains numerous repetitions.

    I've managed to get the following code together based on what I've used before and what I've found searching so far, but it seems to have a bug in it as it wont always work. I also need the original copying of the list to be done to either the new spreadsheet of a different page in the original spreadsheet, but every time I try this it causes an object error.

    PHP Code: 
    Sub Macro3()
    '
    Macro3 Macro
    ' Macro recorded 05/12/2008 by Information Technology
    '
        
    Workbooks.Open Filename:= _
            
    "T:\SST\CCD\Engineering\Backthin_data\Photolith\MASK_DETAILS.xls"
       
    Sheets("Mask List").Range("f4:f2000").AdvancedFilter Action:=xlFilterCopy_
            CriteriaRange
    :=Range("a1:a3"), CopyToRange:=Range("E1:E2000"), Unique:= _
            True
        Selection
    .Sort Key1:=Range("E1:e2000"), Order1:=xlAscendingHeader:=xlNo_
            OrderCustom
    :=1MatchCase:=FalseOrientation:=xlTopToBottom
            Columns
    ("E:E").Select
            Selection
    .Copy
          Windows
    ("MASK_DETAILS.xls").Activate
        ActiveWindow
    .Close
        Windows
    ("Dry_etcher_log_B.xls").Activate
        Sheets
    ("Calc Sheet").Select
        Columns
    ("M:M").Select
        ActiveSheet
    .Paste
     End Sub 
    Could someone kindly point me in the correct direction.

    Thank,
    Gavin.
    Last edited by gavster; 12-08-2008 at 07:47 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I can't test this without the workbooks, but try this

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    02-24-2007
    Posts
    84

    Smile

    Not sure this fully solves the problem.

    I've attached the two files to help explain things, just removed all the extra code and unneeded pages.

    The idea is that the data validation list in column D of the Dry Etch log is always uptodate.

    The list should be a sorted version of column F from the Mask Details spreadsheet. It also needs to have the duplicates removed.

    Thanks,
    Gavin.
    Attached Files Attached Files

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    This seems to work fine for me.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-24-2007
    Posts
    84
    Sorry to be a pain Roy, but I still can't get this to work.

    Could you post a working version based on the files I posted,
    and then I can copy to the main spreadsheet and adjust the file links accordingly.

    Thanks,
    Gavin.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    See if this is right
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-24-2007
    Posts
    84
    Roy,
    I've copied the 2 files to my C drive, and tried to run the macro, but keep getting error 1004 if the Mask Details file is open.

    If I haven't opened the mask details files separately, I get runtime error 9.

    I'm off for the day now, so I'll think about it overnight.

    Thanks for you assistance.

    Gavin.

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Post back tomorrow & I'll take another look.

    The code works fine when I tested it but I had both books open

  9. #9
    Registered User
    Join Date
    02-24-2007
    Posts
    84
    Roy,
    Firstly let me apologise for the delay in replying. I've been a little busy.

    I've retried the modified spreadsheet and it does indeed work fine. Thanks.

    However, for some reason it wont work with the standard spreadsheet that contains all the data.

    I've attached a copy so you can have a look to see if there is any difference, because I cant see it.

    Thanks again,
    Gavin.
    Attached Files Attached Files

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    The only difference that I can see is the data starts in different rows which would throw the code out. I'll have a closer look later but that could be the problem.

    Try changing
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    02-24-2007
    Posts
    84
    Roy,
    It looks like that has solved the problem.

    My only issue now is that I do still get a few duplicates in the list on the second page.

    They do not all appear in the dropdown list I'm using,
    device type 73 appears at both ends. Could this be due to the length of the list?

    If possible, could I filter the Mask Details sheet prior to copying the list, so only device types that are listed as Pad Expose in column H are copied across?

    But thanks for your help so far.

    Gavin.
    Last edited by gavster; 12-11-2008 at 07:58 AM.

+ 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