+ Reply to Thread
Results 1 to 8 of 8

Find cell content and copy row onto new sheet

Hybrid View

cmd105 Find cell content and copy... 04-07-2014, 01:57 PM
PCI Re: Find cell content and... 04-07-2014, 02:28 PM
JOHN H. DAVIS Re: Find cell content and... 04-07-2014, 02:36 PM
cmd105 Re: Find cell content and... 04-07-2014, 02:55 PM
JOHN H. DAVIS Re: Find cell content and... 04-07-2014, 03:13 PM
cmd105 Re: Find cell content and... 04-07-2014, 03:23 PM
PCI Re: Find cell content and... 04-07-2014, 03:29 PM
cmd105 Re: Find cell content and... 04-16-2014, 05:11 PM
  1. #1
    Registered User
    Join Date
    06-14-2013
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    13

    Find cell content and copy row onto new sheet

    Can someone help me with this issue? I have tried to these through formulas without success but i think i need VBA also which i am not very experienced.

    I want to paste a list in the "InsertList" sheet. This list will only contain the word "Correct" or "False". From then on i need a way to search for the word "Correct" or "False" in the columnS P,Q,R,S,T,U,V.

    e.g. If in the column "P" on the "InsertList" sheet the word "Correct" is found, i need that entire row from A to V to be copied onto it's destination, in this case "sheet1".

    If the word "Correct" is found on the column "Q" on the "InsertList" sheet, the rows from A to V need to be copied in the Sheet2. And so on..

    sheet1.png

    Attachment: dropbox.com/s/vgs4kzhoa1pip0a/CopyRows.xltm

    Thanks

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,085

    Re: Find cell content and copy row onto new sheet

    Try
    Option Explicit
    
    Sub CopyData()
    Dim I  As Long
    Dim LastRow1  As Long
    Dim LastRow2  As Long
        For I = 1 To 7
            With Sheets("InsertList")
                If (.AutoFilterMode) Then .AutoFilterMode = False '  REMOVE  AUTOFILTER  IF  EXIST
                LastRow1 = .Range("A" & Rows.Count).End(xlUp).Row
                .Range("A2:V" & LastRow1).AutoFilter Field:=15 + I, Criteria1:="Correct"
                If (.Range("A" & Rows.Count).End(xlUp).Row = 2) Then GoTo NextValue
                .Range("A3:V" & LastRow1).SpecialCells(xlCellTypeVisible).Copy
                With Sheets("Sheet" & I)
                    LastRow2 = Sheets("Sheet" & I).Range("A" & Rows.Count).End(xlUp).Row
                    .Range("A" & LastRow2 + 1).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                        :=False, Transpose:=False
                    .Range("A" & LastRow2 + 1).PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
                        SkipBlanks:=False, Transpose:=False
                End With
            End With
    NextValue:
        Next I
    End Sub
    Last edited by PCI; 04-07-2014 at 03:25 PM.

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Find cell content and copy row onto new sheet

    Does this help?

    Sub cmd105()
    Dim rcell As Range
    For Each rcell In Range("P2:V" & Range("V" & Rows.count).End(3)(1).Row)
        If rcell.Value = "CORRECT" Then
            Select Case rcell.Column
                Case Is = 15
                    Range(Cells(rcell.Row, 1), Cells(rcell.Row, 21)).Copy Sheets("Sheet1").Range("A" & Rows.count).End(3)(2)
                Case Is = 16
                    Range(Cells(rcell.Row, 1), Cells(rcell.Row, 21)).Copy Sheets("Sheet2").Range("A" & Rows.count).End(3)(2)
                Case Is = 17
                    Range(Cells(rcell.Row, 1), Cells(rcell.Row, 21)).Copy Sheets("Sheet3").Range("A" & Rows.count).End(3)(2)
                Case Is = 18
                    Range(Cells(rcell.Row, 1), Cells(rcell.Row, 21)).Copy Sheets("Sheet4").Range("A" & Rows.count).End(3)(2)
                Case Is = 19
                    Range(Cells(rcell.Row, 1), Cells(rcell.Row, 21)).Copy Sheets("Sheet5").Range("A" & Rows.count).End(3)(2)
                Case Is = 20
                    Range(Cells(rcell.Row, 1), Cells(rcell.Row, 21)).Copy Sheets("Sheet6").Range("A" & Rows.count).End(3)(2)
                Case Is = 21
                    Range(Cells(rcell.Row, 1), Cells(rcell.Row, 21)).Copy Sheets("Sheet7").Range("A" & Rows.count).End(3)(2)
            End Select
        End If
    Next rcell
                
    End Sub

  4. #4
    Registered User
    Join Date
    06-14-2013
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Find cell content and copy row onto new sheet

    Can you have a look at the attachment I have on dropbox.com/s/vgs4kzhoa1pip0a/CopyRows.xltm ?

    I tried it but it does not copy anything to the sheet1, 2 , 3 etc.

    Thanks

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Find cell content and copy row onto new sheet

    Can you attach it here on the Forum. Go down to Go Advance and scroll down to the Manage Attachments button, browse to the required file, and then push the Upload button.

  6. #6
    Registered User
    Join Date
    06-14-2013
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Find cell content and copy row onto new sheet

    Sure, here it is:


    CopyRows (1)2.xlsx

    Thanks
    Last edited by cmd105; 04-07-2014 at 03:26 PM.

  7. #7
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,085

    Re: Find cell content and copy row onto new sheet

    Does the code sent not suitable?

  8. #8
    Registered User
    Join Date
    06-14-2013
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Find cell content and copy row onto new sheet

    Thanks PCI, it does work !

+ 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. Replies: 1
    Last Post: 06-14-2013, 04:07 AM
  2. Copy cell content from one sheet to another if there is a match
    By Merco in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 03-15-2013, 02:31 PM
  3. Replies: 4
    Last Post: 10-08-2012, 03:58 PM
  4. [SOLVED] If cell X's content in Sheet A equals to cell Y's content in Sheet B, Then copy some data.
    By sunheroj in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-09-2012, 09:25 AM
  5. Find Min then Copy Cell Content
    By xury2000 in forum Excel General
    Replies: 2
    Last Post: 07-01-2009, 09:53 PM

Tags for this Thread

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