I recently helped a student who has having trouble getting her close-up shots of flowers to be sharp. She was using the macro setting on her compact digital camera and placing the camera close to the blooms. But the pictures were still out of focus.
It turns out there were two issues. The first was that she was photographing outside. Even though the flowers were in the sunshine, there was a bit of a breeze. This caused the flowers to sway gently on their stalks, enough to create a fuzzy photo. The best solution here is to photograph early in the morning when there's less likelihood of breezes to disturb the plants. If you are working in your own garden, you could cut the blossoms and bring them inside out of the breeze. But don't do this in a public park!
The second cause of her blurry flower pictures actually had to do with the way autofocus works. She was trying to photograph a close-up of the center of a tulip petal. But the petal itself had very little detail: no changes in color that would create an "edge" for the camera to focus on. So even though both the camera & the flower were motionless, the picture was still fuzzy.
Autofocus cannot focus on objects without detail or "edges" (what the camera manufacturers call "contrast"). This can cause problems with sky pictures when you are trying to photograph clouds. Even though you can detect the edges of the puffy clouds, there might not be enough detail for the camera to focus. And certainly if you point the camera at a clear blue sky, the lens will not be able to focus. A lack of detail shows up in other places too, like plain walls or smooth concrete.
How do you overcome this? Simply look for an "edge" the same distance as your subject and use focus lock. In the case of the flower close-up, when my student pointed the camera at the edge of the petal instead of in the middle, the lens could focus. Then, keeping her finger on the shutter button to lock the focus, she recomposed the picture and got the image she wanted. For sky photos, try pointing the camera at the horizon or at a distant tree against the sky. Press the shutter button halfway to achieve focus, then recompose for the shot you want.
Lastly, I've seen some blurry sunset shots recently. In these pictures, the photographer was working after the sun had dropped below the horizon. So the light was fading. Even though the sky looked bright to the person, to the camera it seemed dark. So the camera needed a longer exposure time to make the picture. The problem was that the photographer was holding the camera instead of using a support. Hand-holding the camera during this time caused motion blur. So when you're taking sunset shots, use a tripod or other support for a sharp picture.