The Buddha did not say that there is no self at all. That is a common misunderstanding of anatta.
A recurring theme in the Buddha's teachings is the middle way between eternalism and annihilationism.
With respect to the self, annihilationism is the idea that there is no self at all (see SN44.10). In fact, the Buddha rubbished that idea in the Attakari Sutta:
“So, brahmin, when there is the element of endeavoring, endeavoring
beings are clearly discerned; of such beings, this is the self-doer,
this, the other-doer. I have not, brahmin, seen or heard such a
doctrine, such a view as yours. How, indeed, could one — moving
forward by himself, moving back by himself — say ‘There is no
self-doer, there is no other-doer’?”
On the other hand, eternalism is the idea that the self is a permanent absolute eternal standalone entity (see SN44.10) at the core of sentient beings.
You can find this idea described in the Hindu text Bhagavad Gita in chapter 2:
That which pervades the entire body, know it to be indestructible. No
one can cause the destruction of the imperishable soul. Only the
material body is perishable; the embodied soul within is
indestructible, immeasurable, and eternal. The soul is neither born,
nor does it ever die; nor having once existed, does it ever cease to
be. The soul is without birth, eternal, immortal, and ageless. It is
not destroyed when the body is destroyed. As a person sheds worn-out
garments and wears new ones, likewise, at the time of death, the soul
casts off its worn-out body and enters a new one. Weapons cannot shred
the soul, nor can fire burn it. Water cannot wet it, nor can the wind
dry it. The soul is unbreakable and incombustible; it can neither be
dampened nor dried. It is everlasting, in all places, unalterable,
immutable, and primordial. The soul is spoken of as invisible,
inconceivable, and unchangeable.
The Buddha unequivocally rejected eternalism in SN44.10, saying:
"If I — being asked by Vacchagotta the wanderer if there is a self —
were to answer that there is a self, would that be in keeping with the
arising of knowledge that all phenomena are not-self?"
"Sabbe dhamma anatta" (Dhp 279) means "all phenomena are not-self". This means that everything including Nibbana does not have a permanent absolute eternal standalone entity in it.
So, according to the middle way between eternalism and annihilationism, there is neither no self at all, nor a permanent absolute eternal standalone entity anywhere.
In that case, where or what is the self?
Here comes the concept of dependent origination, which is a very complex topic.
A summary of dependent origination with respect to the self, is that the self is a mental idea (Snp 4.14) that arises dependent on the inter-working of the five aggregates of form, feeling, perception, mental fabrications, and consciousness.
A very nice analogy for this is given in the Vina Sutta:
"Suppose there were a king or king's minister who had never heard the
sound of a lute before. He might hear the sound of a lute and say,
'What, my good men, is that sound — so delightful, so tantalizing, so
intoxicating, so ravishing, so enthralling?' They would say, 'That,
sire, is called a lute, whose sound is so delightful, so tantalizing,
so intoxicating, so ravishing, so enthralling.' Then he would say, 'Go
& fetch me that lute.' They would fetch the lute and say, 'Here, sire,
is the lute whose sound is so delightful, so tantalizing, so
intoxicating, so ravishing, so enthralling.' He would say, 'Enough of
your lute. Fetch me just the sound.' Then they would say, 'This lute,
sire, is made of numerous components, a great many components. It's
through the activity of numerous components that it sounds: that is,
in dependence on the body, the skin, the neck, the frame, the strings,
the bridge, and the appropriate human effort. Thus it is that this
lute — made of numerous components, a great many components — sounds
through the activity of numerous components.'
"Then the king would split the lute into ten pieces, a hundred pieces.
Having split the lute into ten pieces, a hundred pieces, he would
shave it to splinters. Having shaved it to splinters, he would burn it
in a fire. Having burned it in a fire, he would reduce it to ashes.
Having reduced it to ashes, he would winnow it before a high wind or
let it be washed away by a swift-flowing stream. He would then say, 'A
sorry thing, this lute — whatever a lute may be — by which people have
been so thoroughly tricked & deceived.'
"In the same way, a monk investigates form, however far form may go.
He investigates feeling... perception... fabrications...
consciousness, however far consciousness may go. As he is
investigating form... feeling... perception... fabrications...
consciousness, however far consciousness may go, any thoughts of 'me'
or 'mine' or 'I am' do not occur to him."
The lute (vina) is a stringed musical instrument similar to a cello, that you can play by plucking. From it comes music. The different parts of the lute are like the five aggregates. Music is like the self. One might think that the music is located somewhere in the lute or pervades the lute.
Using a musical instrument you can play nice music. But if you break it down to its constituent parts, you cannot find music. Music cannot be isolated from the musical instrument. Similarly, the self arises from the inter-working of the five aggregates. You cannot isolate the self from the five aggregates.
Perhaps, you can look at it in this way: The musical instrument is the sentient being. The music coming out of the musical instrument is the self. The musical instrument is composed of various parts which are analogous to the five aggregates. When these parts work together, they make music. The way they work together is dependent origination.
And that is a very nice and simple way to think about anatta.
Please see this answer for a detailed explanation of the lute analogy.