The depth of field (defined as the area of acceptable focus) for any given f/stop is relative to the distance to the subject. It is also relative to the focal length of the lens - but thats another story.
In other words, if you were to use a 50mm f/1.4 lens on a crop sensor body, and shoot a subject 45cm away (which if memory serves is the MFD for that lens) at f/8, your depth of field is going to be 2.19cm. If you moved back, so your subject was 100cm away from you, your depth of field would be 11.6cm. If you were shooting a landscape (for arguments sake, we'll say you can see one mile), at f/8 pretty much anything beyond 16.3 metres will be in 'acceptable focus'.
Because the DoF reduces the closer you get to your subject, you must stop down to get the (approximate) same start and end point of acceptable focus. So to take the example above of f/8 at 100cm away; your near limit would be 94.5 cm and far limit would be 106.1cm, giving you the 11.6cm DoF. If you were to move closer, say to 60cm away, the DoF given by f/8 would reduce, and so you would need to increase it again by stopping down some more to retain that 11.6 (or thereabouts). At 60cm, to get the approx same DoF, you would need to stop all the way down to f/22, giving you 11.5cm of acceptable focus.
The problem with going all the way down to f/22 is that above around f/16 (dependent on the quality of the lens), diffraction starts to creep in. This means you will be sacrificing sharpness of the image even though it will still technically be 'in focus'.
In short, there is no magic f-number at which you will get everything in focus and at its best quality when closeup. I'm not really sure what to suggest for the best... You could perhaps get further away from your subject, and go for that middle f/8-f/11-f/14 range, then crop the photo in post to remove the blurry parts (and thus crop to the same 'image' you would have gotten if you were closer)...
I hope that make sense.
References: I am using this online depth of field calculator to give my figures, above.