jeudi 1 novembre 2018

VBA - update find function to loop through rows and move on if value isn't there

Trying to put together a macro that searches each row to see if it contains 7 search terms (see "Warranty:" example below). If the cell starts with one of the phrases (like "Warranty:"), then that cell is pasted in a specific cell (same row but different column) in another worksheet.

Issues:

  • Had trouble with the macro until I added the select function - I know this slows them down, but I couldn't figure out a way to do this without it
  • Can't figure out how to get it to loop through all rows
  • Errors if the row doesn't have the word - need it to just keep going through

    Sub FindTest()
    
     Worksheets("Macro").Range("1:1").Find(What:="Warranty: ", LookIn:=xlValues, LookAt:=xlPart, MatchCase:=True).Copy
    'Cell begins with "Warranty:" but text following varies
    
    Sheets("CSV Upload").Select
    Sheets("CSV Upload").Range("J1").Select
    ActiveSheet.Paste
    
    End Sub
    
    

Aucun commentaire:

Enregistrer un commentaire