My רבי, my Rabbinic teacher, challenged my class to find the ראשון who is of the opinion that משיח will come no later than 23 years from now. Considering that it is year תשע״ז, year 5,777 in the Jewish calendar, משיח would come by year 5,800, or year ת״ת, according to this opinion. As a G-d fearing Jew, I would be reluctant to base my religious faith on a year, for obvious reasons. But nonetheless, some have predicted 5,800 as the absolute end of גלות, or exile, for the Jews. Does anyone know where I could find this opinion inside?
Ramban on Shir Hashirim might be what you are looking for (second column, about 10 lines from the top). Specifically, it's the Ramban on האלף לך שלמה (Song of Songs 8:11).
My translation would be something like this:
he means to say that Techiyat Hameytim will be 200 years after the redemption that will be 200 earlier to the sixth' thousand and the redemption will be revealed.
Basically, it sounds like Mosiach needs to come 200 years before the end at 6000. Not sure where he is getting the number 200 though.