On most cars, the cold viscosity (the number before the W) makes little difference - the hot viscosity is more important.
Too high a viscosity (too thick) and the oil won't protect at high engine speeds. Too low and the oil pressure will not be high enough to lubricate all the critical parts. In most cars, however, you can go 10 either way with little problem.
One important exception are Ford cars, with the Zetec engine (e.g. focus). There is a design flaw in the Zetec engine which causes the valves to stick - rather than fix the problem, Ford just changed the recommended oil - from 10W40 to 5W30. The use of 5W30 oil is critical in this engine. If you use 10W40 the valves will stick, causing poor performance, and damage to the catalytic convertor. If you use 0W30 oil, the engine won't start (0 weight oil won't develop enough oil pressure, and the ECU treats this as a critical fault and cuts the ignition).
The most important thing though is to check that your oil meets the minimum standard for your engine - for all but the newest VWs, most oils are good enough - but for many manufacturer's latest gen engines, the specification of oil is extremely tight - you need to check that the specifications of the oil are exactly those that your engine requires.