set cell = Cells(5,1).End(xltoRight)(1,2)
is a possibility.
It assumes there are entries in A and B.
If the cells will not have any embedded blank cells
set cell = Cells(5,256).End(xlToLeft)(1,2)
if column A could be blank you would have to check for that
if isempty(cells(5,1)) then
set cell = Cells(5,1)
else
set cell = Cells(5,256).End(xlToLeft)(1,2)
End if