Hello - Thanks for taking the time to read this thread.
I need a macro that imports the value from a specific cell from all the spreadsheets in the same folder as the workbook running the code.
This is my "failed" attemp. It works on my pc but doesn't work on other people's pc (they have older versions of excel). So I guess there must be a much better way to do this 
'Declare variables
Dim WBK As Workbook
Dim WS As Worksheet
Dim RngToCopy As Range, RngToPaste As Range
'Set variables
Set WS = ActiveSheet
Set FileSystemObj = CreateObject("Scripting.FileSystemObject")
Set FolderObj = FileSystemObj.GetFolder(Application.ThisWorkbook.Path)
Application.ScreenUpdating = False: Application.DisplayAlerts = False: ActiveSheet.DisplayPageBreaks = False: Application.Calculation = xlCalculationManual
'Start loop
For Each fileObj In FolderObj.Files
If FileSystemObj.GetExtensionName(fileObj.Path) = "xlsx" Then 'My attempt to make a quick fix to exclude thisworkbook from the loop
Set WBK = Workbooks.Open(fileObj.Path)
Set ImpVal = WBK.Worksheets("Efficiency").[I4] 'Import Value from cell
Set RngToPaste = WS.[A500].End(xlUp).Offset(1, 0) 'Set the target for the pasting
With ImpVal 'Only copy value and not formulas
.Value = .Value
End With
Set RngToCopy = ImpVal 'Set the range to be copied
RngToCopy.Copy Destination:=RngToPaste 'Copy
WBK.Close Savechanges:=False
End If
Next fileObj
Application.DisplayAlerts = True: Application.ScreenUpdating = True: Application.Calculation = xlCalculationAutomatic
End Sub
What I lack the skills to do
I would really like a code that could import the value from cell: Worksheets("Efficiency").[I4], from any spreadsheet in the same folder as thisworkbook no matter what fileextension it has if the spreadsheet has a value in that cell (should of course skip looking in the spreadsheet running the code, which will be in the same folder as the different status reports).
It would be great if the code could detect the users application.screenupdating status and set it to their prior setting after the code (no clue if this is possible).
Bookmarks