Copy file names tosheet
-
I want to "import" a list of all file names with a .h extension into mysheet. Thefile and the .h files will reside in the same directory. So if I have the file names: test.h good.h min.h I should get these mames in the cells B2 though B4 Thanks for your help Thomas
-
Answer:
To accomplish, you must be familiar with Visual Basic for Applications coding (vba, or "macros"). 'From within any module in the Visual Basic Editor, choose from the main 'menu Tools, References and make sure that "Microsoft Scripting Runtime" is 'checked. Then run this sub to list all files in folder C:\TEMP with a name 'that ends in ".h": Sub fileList() Dim fso As Scripting.FileSystemObject Dim fld As Scripting.Folder Dim file As Scripting.file Dim listHere As Range Set listHere = ThisWorkbook.Sheets("sheet1").Range("b2") Set fso = New FileSystemObject Set fld = fso.GetFolder("C:\TEMP\") For Each file In fld.Files If Right(file.Name, 2) = ".h" Then listHere.Value = file.Name Set listHere = listHere.Offset(1) End If Next file End Sub
Miningco.com Visit the source
Related Q & A:
- How To Convert Pmd File To Pdf File Online?Best solution by Yahoo! Answers
- What Is MSI File And How Is It Different From EXE File?Best solution by Stack Overflow
- How can I copy file from Windows to Ubuntu?Best solution by Super User
- How to make a batch file copy itself?Best solution by Yahoo! Answers
- Some good SCENE NAMES not SCREEN NAMES?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.