Consulting

Results 1 to 5 of 5

Thread: if find specify word copy all the row to anther sheet

  1. #1
    VBAX Mentor
    Joined
    Feb 2012
    Posts
    406
    Location

    if find specify word copy all the row to anther sheet

    Hi everyone .
    Hope you are fine
    I need you help regarding very Big Excel file .
    I need a VBA That check from column P to Z and if find specify word copy all the row to another sheet and i need open search dialog for write the specify word .
    Main Data is in Sheet1 and Data must placed is Sheet2
    Really appreciate for your time and effort.

  2. #2
    Like this?
    Code tranfers data from active sheet to the sheet with name Sheet2
    Sub dotch()
    myValue = InputBox("Enter the word you are looking for.", "Word?")
        For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1 'assuming that row 1 contains headers.
        For j = 16 To 26
            If Cells(i, j) = myValue Then
                Range("A" & i & ":Z" & i).Copy Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Offset(1) ' Change sheet name and range if necessary.
                Cells(i, 1).EntireRow.Delete 'Watch out! This line of code deletes the rows on sheet 1 that have been transferred to sheet2
            End If
        Next
        Next
    End Sub
    Have a nice day,
    Philiep

  3. #3
    VBAX Mentor
    Joined
    Feb 2012
    Posts
    406
    Location
    Thanks for your help but ıt does not works i uploaded the sample file for example when i search L180C HL it does not gıve me any result but it is available Can you please try it again .
    Attached Files Attached Files

  4. #4
    VBAX Mentor
    Joined
    Apr 2009
    Location
    Kingsbury
    Posts
    423
    Location
    parscon

    Your database is rubbish no headers, fields missing and to many variants in the search field
    I have managed to cobble together something that works it will find anything for ex L180C HL or partial text
    This will find everything to what you input , probably not the result you were after but try it

    NB it does not delete anything from sheet1 just puts the search data into sheet2 ok
    Rob
    Attached Files Attached Files

  5. #5
    VBAX Mentor
    Joined
    Feb 2012
    Posts
    406
    Location
    Rob342ö Really appreciate for your great works and help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •