gruntingmonkey
Active Member
- Joined
- Mar 6, 2008
- Messages
- 434
- Office Version
- 365
- Platform
- Windows
I have some code which matches up a cell and moves some commentary from one workbook to another. The issue I'm having is handling the selection.find when there is no match. I want to just move on to the next row (I'll put a count in later). but I cant find a way to do this. I tried On error, but it doesn't recognise a non match as an error and therefore debugs rather then moving on. Does anyone have any ideas?
VBA Code:
lastrow = Cells(Rows.Count, "A").End(xlUp).row
rowno = 2
Do Until rowno > lastrow
Workbooks(Filename).Activate
Comment = Cells(rowno, 11).Value
Identifier = Cells(rowno, 19).Value
If Comment <> "" Then
Workbooks(ThisWorkbook.Name).Worksheets("BH Data").Activate
Columns("R:R").Select
Selection.Find(What:=Identifier, After:=ActiveCell, LookIn:=xlFormulas, lookat:=xlPart, SearchOrder:= _
xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False) _
.Activate
Matchrow = ActiveCell.row
Cells(Matchrow, 10).Value = Comment
Else
End If
rowno = rowno + 1
Loop