Quantcast
Channel: Active questions tagged row - Stack Overflow
Viewing all articles
Browse latest Browse all 447

Trying to search for rows containing matching data to move to a new sheet from a list of values - not working

$
0
0

I'm trying to copy every row of a sheet to a new sheet where the values in a particular column ("G") match a list of values on a different sheet column ("A") but then end of a long wait ends with a single row being copied, presumably the last found row.

Here's the code I'm using:

Sub FindData()'Run code to grab all sample data matching to chassis numbersDim s As IntegerDim x As IntegerDim NARow As IntegerNARow = 2For s = 2 To 2920    For x = 2 To 24842        If Sheets("Serials").Cells(s, 1).Value = Sheets("RawData").Cells(x, 7).Value Then            Sheets("RawData").Rows(x).EntireRow.Copy            Sheets("FinalData").Range("A" & NARow).PasteSpecial Paste:=xlValues            NARow = NARow + 1        End If    Next xNext sEnd Sub

Viewing all articles
Browse latest Browse all 447

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>