Nikon won't focus when object is close?
I have an d5100 SLR Nikon (18-200 mm lens) and i used to have no problem focusing when zoomed. Now if i'm on macro mode or zoom in with the lens for something close, it will not focus or let me take a picture. I have auto focus selected and the switch on the lense is on auto. It used to work fine.
There are several things this could be. The most common would be that the item is too close or has insufficient detail for the phase detection to work. If AF doesn't work put the lens in MF mode, if you still can't get focus, then you are too close!
Just because your camera lists a Macro Mode, does not mean it converts a lens into a macro lens.
The macro mode is a specific shutter/aperture setting to enhance the possibility of great macro shots using a macro lens for those who do not have a lot of experience with such things
Your fine 18-200 mm lens has a close focus of 1.6 ft. (0.5m). Closer than that, the lens will not focus and usually the shutter will not fire unless you have the camera and lens set to manual focus mode.
The other possible problem is as mentioned above, is that the subject you are attempting to shoot is either in low light or does not have enough contrast for the auto-focus system to fucus
Your lens at macro mode has a minimum focusing distance of about 1.64 feet or 50 cm. Anything closer than that will be blurred. If you are confident you are beyond that distance, try shooting with more light.