To look for the source file, use the Dir() function. Be aware that this will only select the first match it finds; if you have more than one file, you would need to specify which is the "right" one to choose.
Const FLDR As String = "D:\2023 MOJE pliki tygodniowe\kopie zapasowe\"
Dim rgTarget As Range, f
Set rgTarget = ActiveWorkbook.Sheets("PASTEHERE").Range("B23:EA6000") 'destination file .
f = Dir(FLDR & "*RB*.xlsx")
If Len(f) > 0 Then
rgTarget.FormulaArray = "='" & FLDR & "\[" & f & "]Sheet1'!" & rgTarget.Address(True, True)
rgTarget.Formula = rgTarget.Value
MsgBox "No source file detected"