How long do you need to visit Montserrat? If you organise your own visit and go by train from Placa de Espanya then we would recommend that you set off most of a day. With waiting time and finding platforms etc the train journey and cog train from the valley to the abbey takes 2 hours in total each way.. so 4 hours of transport.
Add to that 2 hours of exploring and 1 hour break time for snacks and souvenir shopping and you are up to 7 hours, so most of the day. If you want to do it all faster then book one of the many tours to Montserrat. One of the fastest and most convenient is from DayTripsBarcelona.com – we are a small, local and family tour company. We have a 4 hour express Montserrat tour with hotel pick-up.
Read more and book here. https://www.daytripsbarcelona.com/b2x_morning_express_tour_barcelona_to_montserrat_mountain_abbey.html