internal links b/w sheets of merged workbooks, using VBA (EXCEL MACROS)
Here are a couple of pointers:

FolderPath should be a constant because it's value will never change
Using a wildcard Filter with the path will ensure that you open the correct files
Although ActiveWorkbook does the job, it is best to get in the habit of using qualified references
Workbook.Worksheets returns a Worksheets Collection (not to be confused with a normal VBA Collection)
Worksheets can be used to perform group operations on all of it's Worksheets at one time
Download RubberDuck.  Among its many great features is Code Indentation.  It will save you a ton of time reformatting and show you unclosed code blocks


Sub merge()
    Const FolderPath As String = &quot;C:\Users\Samiya jabbar\Desktop\test&quot;
    Const Pattern As String = &quot;*.xl*&quot;
    
    Dim Filename As String

    Dim Sheet As Worksheet

    Application.ScreenUpdating = False

    Filename = Dir(FolderPath &amp; Pattern)

    Do While Filename &lt;&gt; &quot;&quot;

        Workbooks.Open(Filename:=FolderPath &amp; Filename, ReadOnly:=True).Worksheets.Move After:=ThisWorkbook.Sheets(1)

        Filename = Dir()

    Loop

    Application.ScreenUpdating = True

End Sub