I hope someone can help me. I'm trying to create a loop to open different workbooks. The idea is every workbook has it's filename that will be called based on the value found in cell B1. I am able to do so - open, copy & paste (specific range) to the MainWorkbook but it only copies the reference found the on the 1st sheet and not those that are in sheets 2, 3, etc. I'm not so sure if the question is clear but basically each sheet has a different value in cell B1 which corresponds to a file in my shared drive. I got no error or anything but sometimes excel just shows gray. So far, I have below:
Sub OpenSesamé()
On Error Resume Next
Application.AskToUpdateLinks = False
Application.EnableEvents = False
Application.DisplayAlerts = False
Dim MainWrbk As Workbook
Dim starting_ws As Worksheet
Dim varCellValue As String
Set MainWrbk = ThisWorkbook
varCellValue = Range("B1").Text
i = 1
Sheets(i).Select
Do
Workbooks.Open "\\Shared_Drive\" & varCellValue & ".xlsx"
ActiveWorkbook.Sheets("30 MINUTES INTERVAL").Select
Range("A3:H51").Copy
MainWrbk.Activate
Range("C4").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
ActiveWindow.ActivatePrevious
ActiveWorkbook.Close
i = i + 1
Sheets(i).Select
Loop Until ActiveSheet.Name = "Summ"
End Sub
Thanks in advance!