With
Set lastCell = c.Cells(c.Cells.Count)
It should allow the the code to figure out how long it needs to be. I orignally thought this may have been the issue as well but this column is simply text based so there's no forumlae to interfer with this count. I'll have a play about with your suggestion and will let you know the outcome.
---------- Post added at 12:44 PM ---------- Previous post was at 12:37 PM ----------
Ok, I've tried your suggestion and now I'm facing a mismatch error. I've made the *after* section into a range. This is the last cell of the column which is being searched. I really can't see what is going wrong with this
Sub StoreNumbers()
Dim FoundCell As Range
Dim lastCell As Range
Dim FirstAddr As String
Dim a As Range 'List of stores
Dim b As Range 'List of store numbers
Dim c As Range 'Conversation headers
For Each a In Worksheets("Reference").Range("L2:L1000")
Set c = Sheets("Recieved").Range("C2:C1000")
Set lastCell = Sheets("Recieved").Range("C1000")
Set FoundCell = c.Find(what:=a, after:=lastCell, LookIn:=xlValues, lookat:=xlPart, searchorder:=xlByRows, _
searchdirection:=xlNext)
If Not FoundCell Is Nothing Then
FirstAddr = FoundCell.Address
Do
Set FoundCell = c.FindNext(FoundCell)
FoundCell.Offset(0, 12).Value = a
Loop Until FoundCell.Address = FirstAddr
End If
Next
End Sub
Any ideas?
Bookmarks