Police officers in Sheffield were granted closure orders for two city centre flats in a crackdown on drugs and anti-social behaviour.
Sheffield magistrates granted the closure orders for two flats in Eldon Court, off Division Street.
The orders ban anyone, including tenants, from entering the flats.
They were applied for after police officers carried out drug raids at the flats last month following complaints about activity there.
A South Yorkshire Police spokesman said: "This the result of a long investigation to tackle reports of drugs and anti-social behaviour within the area.
"Full orders, like these which ban the residents from their properties, are rare and only used as a last resort. However let this be a warning to others engaging in such behaviour that not only can you face criminal charges but you also risk being banned from your own property."