How was Scripture written by divine revelation if nobody had the Holy Spirit?
I think a distinction needs to be made between being indwelt, and being sealed.
When Elizabeth heard Mary’s greeting, the baby leaped in her womb, and Elizabeth was filled with the Holy Spirit. Luke 1:41
In Psalm 51:11, David prayed: Cast me not away from Your presence; take not Your Holy Spirit from me.
Numbers 27:18 And the Lord said to Moses: “Take Joshua the son of Nun with you, a man in whom is the Spirit, and lay your hand on him;
Judges 3:10a The Spirit of the Lord came upon him, and he judged Israel.
Judges 6:34 But the Spirit of the Lord came upon Gideon; then he blew the trumpet, and the Abiezrites gathered behind him.
Judges 13:25 And the Spirit of the Lord began to move upon him at Mahaneh Dan between Zorah and Eshtaol.
Judges 14:6 And the Spirit of the Lord came mightily upon him, and he tore the lion apart as one would have torn
apart a young goat, though he had nothing in his hand. But he did not tell his father or his mother what he had done.
1 Samuel 10:9-10 So it was, when he had turned his back to go from Samuel, that God gave him another heart;
and all those signs came to pass that day. When they came there to the hill, there was a group of prophets
to meet him; then the Spirit of God came upon him, and he prophesied among them.
1 Samuel 16:14 But the Spirit of the Lord departed from Saul, and a distressing spirit from the Lord troubled him.
^ Those are just a few examples...