Hi everybody,
i have a master file and a macro within it. japanese words and english words in columns D & E respectively
I need to find and replace the words in another workbook (all sheets it has) by drag and drop the macro to it..
pls help in this to edit drag and run
Here is the code i have...
Sub Translate()
Dim NameListWB As Workbook, thisWb As Workbook
Dim NameListWS As Worksheet, thisWs As Worksheet
Dim i As Long, lRow As Long
Application.DisplayAlerts = False
Application.EnableEvents = False
Application.ScreenUpdating = False
******* This is the workbook from where my code is running
Set thisWb = ThisWorkbook
******* The sheet count and names are infinity, so pls make changes here
Set thisWs = thisWb.Sheets("testing")
****** This is the master file
Set NameListWB = Workbooks.Open("C:Desktop\Dictionary_master.xlsm")
Set NameListWS = NameListWB.Worksheets("dictionary")
With NameListWS
lRow = .Range("D" & .Rows.Count).End(xlUp).Row
For i = 1 To lRow
thisWs.Cells.Replace What:=.Range("D" & i).Value, _
Replacement:=.Range("E" & i).Value, _
SearchOrder:=xlByColumns, _
MatchCase:=False
Next i
End With
NameListWB.Close SaveChanges:=False
Application.DisplayAlerts = True
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
i have a master file and a macro within it. japanese words and english words in columns D & E respectively
I need to find and replace the words in another workbook (all sheets it has) by drag and drop the macro to it..
pls help in this to edit drag and run
Here is the code i have...
Sub Translate()
Dim NameListWB As Workbook, thisWb As Workbook
Dim NameListWS As Worksheet, thisWs As Worksheet
Dim i As Long, lRow As Long
Application.DisplayAlerts = False
Application.EnableEvents = False
Application.ScreenUpdating = False
******* This is the workbook from where my code is running
Set thisWb = ThisWorkbook
******* The sheet count and names are infinity, so pls make changes here
Set thisWs = thisWb.Sheets("testing")
****** This is the master file
Set NameListWB = Workbooks.Open("C:Desktop\Dictionary_master.xlsm")
Set NameListWS = NameListWB.Worksheets("dictionary")
With NameListWS
lRow = .Range("D" & .Rows.Count).End(xlUp).Row
For i = 1 To lRow
thisWs.Cells.Replace What:=.Range("D" & i).Value, _
Replacement:=.Range("E" & i).Value, _
SearchOrder:=xlByColumns, _
MatchCase:=False
Next i
End With
NameListWB.Close SaveChanges:=False
Application.DisplayAlerts = True
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub