Hi team,
I have a Macro that runs like a dream on a PC, but on the Mac (which is the computer I use) it does not. I've traced it to the two lines highlighted in red. The macro runs when I remove them, but that means I have to manually close hundreds of files. Is there a workaround or fix for this? Any help is much appreciated
I have a Macro that runs like a dream on a PC, but on the Mac (which is the computer I use) it does not. I've traced it to the two lines highlighted in red. The macro runs when I remove them, but that means I have to manually close hundreds of files. Is there a workaround or fix for this? Any help is much appreciated
Code:
Sub ReadInFiles()'
' ReadInFiles Macro
'
Dim looper As Integer
Dim FileName As String
For looper = 1 To 200
Windows("USV_data-master_v0.1").Activate
Sheets(1).Select
FileName = Cells(looper, 1)
Workbooks.Open FileName:= _
"/Users/wilkinli/Documents/Experiments Data/USV/Raw data/" & FileName
Columns("A:P").Select
Selection.copy
Windows("USV_data-master_v0.1").Activate
Sheets.Add After:=ActiveSheet
ActiveSheet.Paste
ActiveSheet.Name = Left(FileName, 9)
[COLOR=#ff0000] Windows(FileName).Activate[/COLOR]
[COLOR=#ff0000] ActiveWindow.Close[/COLOR]
Next looper
End Sub