Hey all,
I am still relatively new to vba but i am looking to really simplify a tedious task.
The code below will take all files in a folder and copy the total column (E43) from each worksheet (Jan-Dec) and place it under the appropriate month.
However, after talking to some fellow students i have devised a slightly different sheet to eliminate all manual data entry.
what I am now looking for is a way with this code, or even another, to copy the data from a file name corresponding to the name in column A. For instance BrianJohnstons data will always be in row 11 regardless of what order the files are in.
columns E-P will correspond to cell E43 in each similarly named sheet (Jan-Dec)
Column S will correspond to C43 in each of the 12 sheets but it will be a total of all 12 numbers.
Column U will correspond to D43 in each of the 12 sheets but it will be a total of all 12 numbers.
This master file will contain 20+ other names so this needs to easily allow the adding in of additional names/corresponding files, if possible.
I appreciate any help anyone can provide even just pointing me in the right direction.
The code i already have is:
Master File AmeriCorps.xlsxBrianJohnson.xls
I am still relatively new to vba but i am looking to really simplify a tedious task.
The code below will take all files in a folder and copy the total column (E43) from each worksheet (Jan-Dec) and place it under the appropriate month.
However, after talking to some fellow students i have devised a slightly different sheet to eliminate all manual data entry.
what I am now looking for is a way with this code, or even another, to copy the data from a file name corresponding to the name in column A. For instance BrianJohnstons data will always be in row 11 regardless of what order the files are in.
columns E-P will correspond to cell E43 in each similarly named sheet (Jan-Dec)
Column S will correspond to C43 in each of the 12 sheets but it will be a total of all 12 numbers.
Column U will correspond to D43 in each of the 12 sheets but it will be a total of all 12 numbers.
This master file will contain 20+ other names so this needs to easily allow the adding in of additional names/corresponding files, if possible.
I appreciate any help anyone can provide even just pointing me in the right direction.
The code i already have is:
Code:
Sub aaron_gather()
'
' aaron_gather Macro
Dim bestandopen
Application.ScreenUpdating = False
On Error Resume Next 'if there are no 12 sheets
bestandopen = Dir("H:\Americorps\*")
Do Until bestandopen = ""
If bestandopen = "" Then Exit Do
If Not bestandopen = "Master File Americorps1.xlsm" Then
Workbooks.Open "H:\Americorps\" & bestandopen
ThisWorkbook.Sheets(1).Cells(Rows.Count, 1).End(xlUp).Offset(1) = ActiveWorkbook.Name
For i = 1 To 12
ThisWorkbook.Sheets("Sheet 1").Cells(Rows.Count, 1).End(xlUp).Offset(, i) = ActiveWorkbook.Sheets(i).Range("E43")
Next i
ThisWorkbook.Sheets("Sheet 1").Columns.AutoFit
Workbooks(bestandopen).Close
End If
bestandopen = Dir
Loop
End Sub