Copy Data from 1 sheet to another based on criteria

  • Copying Data from Workbooks("Sheet1").Worksheets("Sheet1") Range("A5:BBC5") if that row has a word "king" it should copy the data of complete row and paste it to Workbooks("Sheet2").Worksheets("Sheet2") Range("K10") that sheet.


    I am unable to figure it out that why my code is not working.


    any help would be highly appreciated.



  • Without a workbook to reference, this is my best guess...

    If I've been helpful, let me know. If I haven't, let me know that too.

  • dangelor


    apologies that i have not uploaded the sheets. But now i have uploaded the sheets which accurate data. to copy paste the data on a condition


    Sheet1 has data which is available in row 4 and 5, where code will fetch that in row 4 has word "0f3" then code will copy the exactly data available under word "0f3" to end of the data (Data of row 5 will be copied) and paste into sheet2 range J10 to further...


    The code will not copy the data which is before the word "0f3" that is highlighted."


    I have pasted the required data into Sheet2 which is required from Sheet1.

  • Try this...

    Code
    1. Sub Copy_Row()
    2. Dim c As Range
    3. With Workbooks("Sheet1.xlsx").Worksheets("Sheet1")
    4. Set c = .Rows(4).Find("0f3")
    5. If Not c Is Nothing Then
    6. .Range(c.Offset(1), c.Offset(1).End(xlToRight)).Copy Workbooks("Sheet2.xlsx").Worksheets("Sheet2").Cells(10, 11)
    7. End If
    8. End With
    9. End Sub

    If I've been helpful, let me know. If I haven't, let me know that too.

  • If I've been helpful, let me know. If I haven't, let me know that too.