Is there an Easy way to copy and paste file names into Excel

User Name

Spammer
Joined
Aug 10, 2010
Messages
182
The title says it all. I want to perform a series of operations on a batch of files. In the past I've always had the names of the files in a list on a worksheet. I'd like to know if there's a way to select a bunch of filenames and move those filenames onto a worksheet? I've done this via the DOS screen once before but I was wondering if anyone here knew of a simple alternative.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
I'm not sure what you're doing or asking for. Copy and paste filenames from where? What operations do you want to do on these files?

You mention a DOS window; how are filenames being displayed in this window? With a DOS command, e.g. DIR? The simplified VBA equivalent is the Dir function, so maybe you could try that to get the file names into Excel.
 
Upvote 0
Filenames from a folder full of files of course. I want to know what their names are so I can tell my vba script to open file X, do this, do that, save as XYZ, open file Y, do this... and so on.

In the past I've used a list of filenames on an excel worksheet. The open instruction in VBA would use the list in the worksheet to figure out which file to go get.

The DIR command sounds vaguely familiar. If you use that command you'll get a page full of filenames that you can cut and paste into an excel worksheet IIRC. I'll just do it that way I suppose. I was asking if anyone knew of another way to do it. oh well...
 
Upvote 0
The DIR command worked fine. Thank you for reminding me of this. Seems easy enough. I don't know why I remembered it being harder to do last time. Anyways... thanks... problem solved.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,717
Members
452,939
Latest member
WCrawford

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
Back
Top