Hello All, this is my first post and I am wondering how quick I will get a useful solution for my VBA newbie problem.
I want to copy data from a single column which has the following location "F9:F26283", the data is to be retrieved from approximately 100 excelfiles with the same tab/sheet name "ReportHeader".
Additionally the data in the column is separated by blank cells (see screenshot), as soon as the data is to be pasted into the data acquisition workbook I would like to have no blank cells between my (value) data.
I am looking for a macro that can do the above by going through the excelfiles by opening-retrieving data-paste data-closing. The filenames can be attained through a macro button that runs the code stated below
The separate excelfiles have different filenames, however scavenging from an older macro I used I am able to retrieve all the filenames from a single folder by using this macro, this data can then be fed into macro as requested above:
EXISTING MACRO "GET FILENAMES FROM FOLDER"
Private Sub CommandButton1_Click()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim i As Integer
'Create an instance of the FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object
A = Cells(2, 2).Value
Set objFolder = objFSO.GetFolder(A)
i = 1
'loops through each file in the directory and prints their names and path
For Each objFile In objFolder.Files
'print file name
Cells(i + 4, 1) = objFile.Name
'print file path
Cells(i + 4, 2) = objFile.Path
'print last modified date
Cells(i + 4, 3) = objFile.DateLastModified
i = i + 1
Next objFile
End Sub
Please help, thanks a lot in advance! I am curious how fast I would get an useful solution to this newbie problem I have
Regards,
DEBOER
I want to copy data from a single column which has the following location "F9:F26283", the data is to be retrieved from approximately 100 excelfiles with the same tab/sheet name "ReportHeader".
Additionally the data in the column is separated by blank cells (see screenshot), as soon as the data is to be pasted into the data acquisition workbook I would like to have no blank cells between my (value) data.
I am looking for a macro that can do the above by going through the excelfiles by opening-retrieving data-paste data-closing. The filenames can be attained through a macro button that runs the code stated below
The separate excelfiles have different filenames, however scavenging from an older macro I used I am able to retrieve all the filenames from a single folder by using this macro, this data can then be fed into macro as requested above:
EXISTING MACRO "GET FILENAMES FROM FOLDER"
Private Sub CommandButton1_Click()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim i As Integer
'Create an instance of the FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object
A = Cells(2, 2).Value
Set objFolder = objFSO.GetFolder(A)
i = 1
'loops through each file in the directory and prints their names and path
For Each objFile In objFolder.Files
'print file name
Cells(i + 4, 1) = objFile.Name
'print file path
Cells(i + 4, 2) = objFile.Path
'print last modified date
Cells(i + 4, 3) = objFile.DateLastModified
i = i + 1
Next objFile
End Sub
Please help, thanks a lot in advance! I am curious how fast I would get an useful solution to this newbie problem I have
Regards,
DEBOER