listing which documents were changed by macro

  • Thread starter Thread starter alan
  • Start date Start date
A

alan

I have a macro which goes through hundreds of documents
and changes old product names to new product names. This
uses Excel's find and replace functions. After the macro
is finished, I would like to have a list of which
documents were changed and which were not. I have to
redistribute hard copies of the documents that were
changed, so I don't want to worry about the documents that
were not changed.

Is there a way to know whether a find/replace search for a
document made any changes or not? Thanks.
 
As the macro goes through the workbooks, you should keep a list of workbooks
which have changed (in my example, the list is on a new worksheet in the
active workbook). You will know that a workbook has changed when its Saved
property is False.

For example:

Dim ws As Worksheet, wb As Workbook
Set ws = Worksheets.Add
For Each Workbook In Workbooks
If Not wb.Saved then
ws.Range("A" & Rows.Count).End(xlUp).Offset(1) = wb.Name
End If
Next

Hard to be more specific without knowing more about your code.
 
Back
Top