How do I fix splintered floor boards prior to refinishing?

I removed the carpeting in a bedroom and found hardwood floors underneath. Around the perimeter and inside the closets were painted(different colors). The middle section had not been painted(looks like an oversized rug had been covering it up). Some of the boards in the unpainted section are splintering. Is there a way to fix these boards so that I can refinish the floor? I tried sanding them and they just splintered more.
I will be repainting the room as well. Do I do the floor first or paint the walls first?

  4 answers