Properly set, the derailleur will shift to both the extreme outward sprocket (the smallest in size) and the extreme innermost sprocket (the largest in size). The limit screws do not control the derailleur on the sprockets between the two extremes. These are set using the barrel adjuster and tension on the inner wire. The limit screws are usually marked "H" and "L". The "H" controls the outer most limit of the derailleur, and the L-limit screw controls the inner most limit.
Using the shift lever to adjust limit screws can cause confusion and problems because it tends to focus attention on the inner wire tension (indexing) rather than limit screw settings. Instead of using the shift lever, pull the inner wire with one hand to simulate shift lever action. This will help eliminate confusion between indexing problems and limit screw problems. With the bike in a stand, practice shifting with this method before adjusting the limit screws.
Turning the limit screws adjusts the limit of travel of the pulleys. Tightening restricts the travel, while loosening allows more travel. The idea is to find the tightest H-limit screw setting that will allow a good shift to the outermost cog, and the tightest L-screw setting that will allow a good shift to the innermost cog. The location of limit screws on the derailleur body may vary between manufacturers. Always look for the "H" and "L" marked adjacent to the screws.