To sand a floor properly, you need to remove all skirting, so you're probably best doing the floor first, protect it well, replace skirting and then move on to walls and ceiling.
If you're hoping to get away without removing skirting, then you might want to paint walls and ceilings first. That way you won't have to be so super careful of protecting your newly finished floor.
The usual method is to work from the top down. Ceilings then walls then flooring. Make sure your paint is 100% dry before sanding and that you have a vacuum attached & wear proper protection.