The only silent speed is slow speed, 2 or even 1 knots, if you go to the zentrale (F2), just behind your 1wo, or conning tower you can see the engine revolutions, there's 2 dials, if those are 100 or below you're silent, if not, they can and will hear you.
as to distance, depends on lots of things enemy speed, water condition weather, generally you're not safe unless silent at 6km or less, or if heavy weather and at periscope depth, maybe 3 or 4 knots.
as to targetting stationary ships, your scope is generally accurate enough even at 8km
Tobruk is a death-trap, but i guess you found out the hard way
Good luck and sink them all!