Ubaci sledeci kod u novi dokument u kome su u koloni A reci koje trazis a u koloni B reci kojima ih menjas,
zatim otvori sve one Excel fajlove u kojima treba menjati reci i startuje proceduru. Obrati paznju da ti Undo
nece biti od pomoci pa je mozda najbolje da prvo bekapujes sve te Excel fajlove.
Code:
Sub Replace()
Dim curCell As Range
Dim curRow As Long
Dim i As Integer
Dim strSearchFor As String
Dim strReplaceWith As String
On Error Resume Next
'
' Proveri da li ima jos otvorenih Excel fajlova
'
If Workbooks.Count = 1 Then
MsgBox "Moras otvoriti i ostale Excel fajlove", vbCritical, "Workbooks replace - Error"
Else
' Prodji kroz sve otvorene fajlove i napravi izmene
'
For i = 1 To Workbooks.Count
If Workbooks(i).Name <> ThisWorkbook.Name Then
' Prodji kroz sve celije u koloni A
' Pocevsi od 1. reda
'
curRow = 1
Set curCell = ThisWorkbook.ActiveSheet.Cells(curRow, 1)
strSearchFor = curCell.Value
strReplaceWith = curCell.Offset(0, 1).Value
Do While strSearchFor <> ""
Workbooks(i).ActiveSheet.Cells.Replace What:=strSearchFor, Replacement:=strReplaceWith, _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
curRow = curRow + 1
Set curCell = ThisWorkbook.ActiveSheet.Cells(curRow, 1)
strSearchFor = curCell.Value
strReplaceWith = curCell.Offset(0, 1).Value
Loop
End If
Next i
End If
End Sub
Pozdrav