insert all excel files name into excel from folder

Rahulwork

Active Member
Joined
Jun 9, 2013
Messages
284
hello everyone

i want to insert all excel file into exceel from specific path metioned in A1

target or destination cell would be B1
 

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,386
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
This will list all Excel files in the folder whose path is specified in A1 of the active sheet. List will begin in B1.
VBA Code:
Sub ListExcelFiles()
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set F = fs.GetFolder(Range("A1").Value)
    iRow = 1
    On Error Resume Next
    For Each myfile In F.Files
        If myfile.Name Like "*.xls?" Then
            Cells(iRow, 2).Value = myfile.Name
            iRow = iRow + 1
            N = N + 1
        End If
    Next myfile
    Columns("B").AutoFit
    MsgBox N & " files listed"
End Sub
 

Rahulwork

Active Member
Joined
Jun 9, 2013
Messages
284

ADVERTISEMENT

Hello . Posted some questions pls respond 😭
 

Rahulwork

Active Member
Joined
Jun 9, 2013
Messages
284

ADVERTISEMENT

 

Rahulwork

Active Member
Joined
Jun 9, 2013
Messages
284
 

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,386
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Your "questions" in Posts #7 & #8 are two separate threads, not part of this thread, as they should be.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,232
Messages
5,594,956
Members
413,954
Latest member
mrsandy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top