Hi im new to VBA excel and i want to import data this part i can do fine but in the same sub i want to open a new worksheet in the same workbook and in that worksheet i want to keep the file names of the data i imported from.
Sub GetData()
        Dim path As Variant
        Dim excelfile As Variant
        Dim data_file(1 To 100) As String
        path = "C:\dummmy\"`
        main_file = ActiveWorkbook.Name
        excelfile = Dir(path & "*.xls")
        Do While excelfile <> ""
        data_file(k + 1) = excelfile
         With ThisWorkbook
            .Sheets.Add(After:=.Sheets(.Sheets.Count)).Name = "Test"
            ActiveSheet.Paste = datafile(k+1)
        End With' 
rest of the code the problem i have having is just putting the address of the file in a different worksheet
 
     
    