Good afternoon, I do not understand what the problem is. A macro should run through all the files, make changes and save them, but applies only to the book from which I run. What can be wrong?
Sub Auto_Write_In_Books() Dim sFolder As String Dim sFiles As String Dim li As Long With Application.FileDialog(msoFileDialogFolderPicker) If .Show = False Then Exit Sub sFolder = .SelectedItems(1) End With Application.ScreenUpdating = True sFiles = Dir(sFolder & Application.PathSeparator & "*.xls*") On Error Resume Next Do While sFiles <> "" Workbooks.Open sFiles ' начало макроса ' Cells.Replace What:="с/", Replacement:="", LookAt:=xlPart, SearchOrder _ :=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False Cells.Find(What:="исполнитель", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate ActiveCell.Offset(-1, 0).Range("A1").Select ActiveCell.FormulaR1C1 = "ООО ""ТЭК""Интеллект Логистик""" ' конец макроса ' ActiveWorkbook.Close SaveChanges:=True sFiles = Dir Loop Application.ScreenUpdating = True End Sub
sFilesis equal to the current book. In this case, the book should not be closed (and you should not open it, otherwise the book will be re-opened, and the macro launch will also stop) - Edward Izmalkov