The SNP’s leader in Westminster wished Mr Cameron well as the premier prepares to formally leave Downing Street.
But Mr Robertson then blasted Mr Cameron and the Government for trying to take Scotland out of the EU “against the wishes of Scottish voters”.
Speaking during Prime Minister’s Questions, he said: “Notwithstanding our differences I genuinely extend my best personal wishes to the Prime Minister and to his family. I wish them all the best.
“However, the Prime Minister’s legacy will undoubtedly be that he has taken us to the brink of being taken out of the European Union so we will not be applauding his premiership on these benches.
“What advice has he given his successor on taking Scotland out of the EU against the wishes of Scottish voters?”
Mr Cameron praised Theresa May, who will take over as PM, as a “brilliant negotiator” before telling the House that his advice to her is that the UK should be “as close to the European Union as we can be for the benefits of trade, of cooperation and of security”.
“The Channel will not get any wider once we leave the European Union and that is the relationship we should seek,” he said.
“That will be good for the United Kingdom and good for Scotland.”
Mr Robertson said Mrs May is “very well known” in Scotland because of the planned deportation of the Brain family from the Highlands.
He also pointed to the likelihood that Mrs May’s first major Commons vote will be on “imposing” Trident against the wishes of “almost every single MP from Scotland”.
He asked: “How does the outgoing prime minister think that all of this will go down in Scotland?”
Mr Cameron said it is right that MPs will vote on Trident and that “many people in Scotland support our nuclear deterrent”.
He said: “You ask about the record of this Government when it comes to Scotland, well I’ll tell him what it is: 143,000 more people in work in Scotland, massive investment in the renewable industries in Scotland, the two biggest warships ever built in our history built in Scotland, a powerhouse parliament, a referendum that was legal, decisive and fair, and I might add a Scotsman winning Wimbledon twice while I was prime minister.”