Results 1 to 6 of 6

Find and copy to other worksheet if not find something else.

Threaded View

  1. #1
    Registered User
    Join Date
    08-07-2013
    Location
    Saudi Arabia
    MS-Off Ver
    Excel 2007 - 2010
    Posts
    73

    Find and copy to other worksheet if not find something else.

    Hello guys,

    What I need to do is to find CP1 in a determined column, if it does, copy the cell and paste it into other file (Dabase.xlsm), if not it should look for CP2 until CP4. If doent find any of them, Delete the sheet.

    But until know, I havent find the way to pass the error if it doesnt find anything. This is what I have:

    Thanks in advance for the help!!

    
    CP1 = "WEA"
    
    ' Select Resp. Company entire column and Find CP1
        Windows("MorningReport.xls").Activate
        Range("A1").Select
        Cells.Find(What:="Resp. Co", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
            xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
            , SearchFormat:=False).Activate
        ActiveCell.EntireColumn.Select
        Selection.Find(CP1).Activate
        
    ' If it finds - Copy and Paste to Database
        ActiveCell.Select
        Selection.Copy
        Windows("Database DS.xlsm").Activate
        Range("A1").Select
        Cells.Find(What:="Company", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
            xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
            , SearchFormat:=False).Activate
        Selection.End(xlDown).Select
        ActiveCell.Offset(1, 0).Select
        Selection.PasteSpecial Paste:=xlPasteValues
        
    End Sub
    Last edited by jnh0; 08-13-2013 at 08:52 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Code to find value and copy row to new worksheet
    By ybortony in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-13-2013, 06:33 PM
  2. Find,Copy and paste to other worksheet vba
    By emina002 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-09-2012, 10:03 PM
  3. help with a macro to find a worksheet and copy it
    By deucejmp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-14-2011, 09:38 PM
  4. Find and copy cells from one worksheet to another
    By Andre0170 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-29-2010, 06:25 AM
  5. Find Value and Copy/Paste Row from One Worksheet to Another
    By GravityInvert in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-15-2008, 02:56 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