View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default workbook file name

Hi Ranjith

Try the below macro which will list all the .csv (comma seperated values)
file names in the folder to Col A...Adjust the folder name to suit.

Sub FileswithinFolder()
Dim strFile As String, strFolder As String, intCount As Integer
strFolder = "c:\temp"
strFile = Dir(strFolder & "\*.csv", vbNormal)
Do While strFile < ""
intCount = intCount + 1
Range("A" & intCount) = strFile
strFile = Dir
Loop
End Sub

--
Jacob


"Ranjith Kurian" wrote:

I have nearly 50 workbooks(.csv format) in a folder, i need a macro to copy
all the workbooks Names to a new worksheet.