Hi! I'm new here.
I have a workbook that handles data from several source files located in a folder (C:\documents\, for instance). I'm trying to create an Excel macro that creates one sheet for every file inside this existent workbook. It should create a new sheet (if it already doesn't exist), copy all the content inside this sheet and then close the data source.
The code I have so far is not working. It's the following:
Can anyone help me?
I have a workbook that handles data from several source files located in a folder (C:\documents\, for instance). I'm trying to create an Excel macro that creates one sheet for every file inside this existent workbook. It should create a new sheet (if it already doesn't exist), copy all the content inside this sheet and then close the data source.
The code I have so far is not working. It's the following:
Code:
Sub FindExcelFiles()
Dim FileName As String
Dim FolderPath As String
FolderPath = "C:\Documents\"
FileName = Dir(FolderPath & "\*.xls", vbNormal)
Do While FileName <> ""
FileName = Dir
Workbooks.Open (FileName)
Loop
End Sub</pre>
Can anyone help me?