Hello to all.
My second problem:
This macro also works perfectly: I open a new workbook (book1), I put my macro button to call after his appearance, immediately began to seek how many workbooks are in a folder where it is located (book1). For example, in a folder Trii / 10 I excel file that shows them to me in column A: A (book1), then in the box izkochiliyat I wanted to write about what I want to look and how to replace it - this is the same as standard option in excel (Find and Replace) but looking in all workbooks and the problem here is that the macro is designed to look at specific cells and truly replaces words.
So the problem is whether you less to fix it to look absolutely all cells in all worksheets.
I believe that is a matter of minor fixes somewhere in the code, but because they do not understand, I do not know where to Complete the thing.
I want to thank you in advance for all your help.Code:Sub general() Dim z As Long, e As Long, g As Long Dim f As String, m As String, n As String Sheets("Sheet1").Select Cells(1, 1) = "=cell(""filename"")" Cells(1, 2) = "=left(A1,find(""["",A1)-1)" Cells(2, 1).Select f = Dir(Cells(1, 2) & "*.xls") Do While Len(f) > 0 ActiveCell.Formula = f ActiveCell.Offset(1, 0).Select f = Dir() Loop m = InputBox("Enter search string") n = InputBox("Enter replacement string") 'common replacement z = Cells(Rows.Count, 1).End(xlUp).Row For e = 2 To z If Cells(e, 1) <> ActiveWorkbook.Name Then Workbooks.Open Filename:=Cells(1, 2) & Cells(e, 1) For a = 1 To Sheets.Count 'n = InputBox("Enter replacement string for sheet - " & Worksheets(a).Name) ' sheetwise replacement x = Worksheets(a).Cells(Rows.Count, 3).End(xlUp).Row For b = 2 To x If InStr(Worksheets(a).Cells(b, 3), m) > 0 Then Worksheets(a).Cells(b, 11) = n End If Next b Next a ActiveWorkbook.Close True End If Next e MsgBox "collating is complete." End Sub


Reply With Quote
Glad being of some help
.

Bookmarks