A balance sheet balances, so every asset matches a liability. A sale like this doesn't alter the sheet, they are merely swapping one asset (a building) for another (cash).
What is affected is cash and cash flow.
The profits probably haven't been accrued in past P&L's have they?
So the amount of profit will be a credit to equity and a debit to cash, improving the leverage of the balance sheet.
But that's beside the point, any good analyst would have already adjusted their balance sheet to take account of the value of real estate.
My best guess is that they are planning a round of lay-offs and will use progressively less space in the building. I'd wager that they plan to move headcount to lower cost areas. They also view the real estate market as peaking and want to get out at the top instead o ending up with a depreciating asset. These are just my wild guesses though, no analysis to back it up.
Overall, it's a smart move.
Appreciating assets like building of course have a different affect on the P&L, but then so do the loans you take out to finance them.
If you mean the building, it's because they can take advantage of the gains and add that to their balance sheet and then slowly spend it back down.