I am running a fairly large block of code on quite a lot of data(4 to 5 thousand lines x several columns).
I have two criteria:
"wsApt.Cells(lRow, 2) and wsApt.Cells(lRow, 5).Value" need to match when looking through a sheet with thousands of lines. Upon finding a match, the value of a certain cell(wsReadings.Cells(rReadings.Row, 6)) should be pasted into wsApt.Cells(lRow, 6). This might be a little hard to follow, so I have attached the code.
sKey = wsApt.Cells(lRow, 2).Value + wsApt.Cells(lRow, 5).Value
Set rReadings = wsReadings.Cells.Find(what:=sKey, after:=wsReadings.Cells(1, 1), LookIn:=xlFormulas, _
lookat:=xlWhole, searchorder:=xlByRows, searchdirection:=xlNext, MatchCase:=False)
If Not rReadings Is Nothing Then
wsApt.Cells(lRow, 6).Value = wsReadings.Cells(rReadings.Row, 6).Value
Else
lErrRow = wsError.Cells(Rows.Count, 1).End(xlUp).Row + 1
wsError.Cells(lErrRow, 1).Value = wsApt.Cells(lRow, 2).Value
wsError.Cells(lErrRow, 2).Value = "No Begin Reading Found"
End If
Any input would be greatly appreciated. Sorry if I am not clear enough, I'll try to help you understand. Thanks in advance.
Bookmarks