Hi all,
I have a query in that I'd like a macro to open each workbook in a folder and copy the data into one new accumulative workbook. The data in each of the workbooks are similar and have the same headings.
For a bonus I also have the following code to add that will then label where the data is from based on it's filename in the folder.
Function GetFilenameFromPath(ByVal strPath As String) As String
' Returns the title of a string up to but not including the rightmost '\'
If Right$(strPath, 1) <> "" And Len(strPath) > 0 Then
GetFilenameFromPath = GetFilenameFromPath(Left$(strPath, Len(strPath) - 1)) + Right$(strPath, 1)
End If
End Function
Any help would be much appreciated.
I have a query in that I'd like a macro to open each workbook in a folder and copy the data into one new accumulative workbook. The data in each of the workbooks are similar and have the same headings.
For a bonus I also have the following code to add that will then label where the data is from based on it's filename in the folder.
Function GetFilenameFromPath(ByVal strPath As String) As String
' Returns the title of a string up to but not including the rightmost '\'
If Right$(strPath, 1) <> "" And Len(strPath) > 0 Then
GetFilenameFromPath = GetFilenameFromPath(Left$(strPath, Len(strPath) - 1)) + Right$(strPath, 1)
End If
End Function
Any help would be much appreciated.