Hi All,
Every month I have this task of collecting data from about 200 reports, into a main central consolidation file.
The Report is an Excel file stored on SharePoint. All the Data i need is on a hidden tab in one Range.
Process:-
1. I go to the SharePoint site where the files are stored and export the list to excel
2. I then compare the SharePoint list to what is already in my consolidation.
3. With the missing files (new files uploaded to SharePoint since last consolidation) not in my consolidated file i copy a column "C" and place this into a workbook column "C" where i have the following Macro.
4. I press the button and The Macro works and i get my data (Code below)
Issue:
once i activated the macro in i still need to click "OK" each the macro loops and a new file opened.
Is their anyway to re-write the code so i don't have to sit around clicking "OK" and go do something more productive while the code does it work?
/Snowcrash
Every month I have this task of collecting data from about 200 reports, into a main central consolidation file.
The Report is an Excel file stored on SharePoint. All the Data i need is on a hidden tab in one Range.
Process:-
1. I go to the SharePoint site where the files are stored and export the list to excel
2. I then compare the SharePoint list to what is already in my consolidation.
3. With the missing files (new files uploaded to SharePoint since last consolidation) not in my consolidated file i copy a column "C" and place this into a workbook column "C" where i have the following Macro.
4. I press the button and The Macro works and i get my data (Code below)
Issue:
once i activated the macro in i still need to click "OK" each the macro loops and a new file opened.
Is their anyway to re-write the code so i don't have to sit around clicking "OK" and go do something more productive while the code does it work?
/Snowcrash
Code:
Sub Consolidation()
Dim masterFile As Workbook
Dim copyWorkbook As Workbook
Dim lastRow As Long
Dim rowPosition As Long
With Application
.ScreenUpdating = False
.DisplayAlerts = False
.AskToUpdateLinks = False
End With
Set masterFile = ThisWorkbook
lastRow = Cells(Rows.Count, 3).End(xlUp).Row
For rowPosition = 4 To lastRow
Cells(rowPosition, 3).Hyperlinks(1).Follow
Set copyWorkbook = ActiveWorkbook
With copyWorkbook.Sheets("consolidation")
.Visible = True
.Range("B4:BCQ44").Copy
End With
masterFile.Worksheets(1).Range(Cells(rowPosition, 6).Address).PasteSpecial xlValues
copyWorkbook.Close SaveChanges:=False
Next rowPosition
With Application
.DisplayAlerts = True
.ScreenUpdating = True
.AskToUpdateLinks = True
End With
End Sub