View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bartosz Bartosz is offline
external usenet poster
 
Posts: 15
Default Replaced text count



€˛Bartosz€¯ pisze:

Hello,

I made macro wich repace texts in other one in many Excel files (using
replace method). I think about making report after to know how many changes
was made in each files:

text to replace new text
aaaa bbbbb
cc XXXXX
.....

Files:
1.xls, 2.xls

Repor:
File sheet text to replace new text count
1.xls Sheet1 aaaa bbbbb 3
1.xls Sheet1 cc XXXXX 3
1.xls Sheet2 aaaa bbbbb 0
1.xls Sheet2 cc XXXXX 34
...
2.xls Sheet1 aaaa bbbbb 3
2.xls Sheet1 cc XXXXX 3
...
Count column contan number of changes as it is show after "hand made"
replace (Ctr+H).

Bartosz


I use this code in macro:
For Each ws In Worksheets
Worksheets(ws.Name).Activate
For X = 1 To ilelinii - 1
Cells.Replace What:=strTabela(X, 1),
Replacement:=strTabela(X, 2), LookAt:=dopasowanie, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
Next X
Next ws


strTabela(X, 2) is table with texts to change and new one.
dopasowanie is xlWhole/xlPart define by user

Probably to count chages I will need another one.

Bartosz