Hi all,
I have a Workbook with one sheet called "Translation" with a translation table. There are 1.300 rows in this table, with words translated from English to Spanish, starting in cell "A1"
[TABLE="width: 500"]
<tbody>[TR]
[TD]English[/TD]
[TD]Spanish[/TD]
[/TR]
[TR]
[TD]Assets[/TD]
[TD]Activo[/TD]
[/TR]
[TR]
[TD]Liabilities[/TD]
[TD]Pasivo[/TD]
[/TR]
</tbody>[/TABLE]
What I need is a code that goes to every sheet and translate every word from English to Spanish.
I already have a code that do what I want, the problem is that for every sheet, the code checks the 1.300 rows of my translation table and then go to the next sheet and checks the 1.300 rows of my translation table and go to the next sheet, etc.
As I have 40 sheets, the process is taking to long and I´m looking for a way to do this quicker.
Any of you could improve this code or just give me another one that do what I need?
The code is the following.
I hope you could help me.
Thanks in advance!
I have a Workbook with one sheet called "Translation" with a translation table. There are 1.300 rows in this table, with words translated from English to Spanish, starting in cell "A1"
[TABLE="width: 500"]
<tbody>[TR]
[TD]English[/TD]
[TD]Spanish[/TD]
[/TR]
[TR]
[TD]Assets[/TD]
[TD]Activo[/TD]
[/TR]
[TR]
[TD]Liabilities[/TD]
[TD]Pasivo[/TD]
[/TR]
</tbody>[/TABLE]
What I need is a code that goes to every sheet and translate every word from English to Spanish.
I already have a code that do what I want, the problem is that for every sheet, the code checks the 1.300 rows of my translation table and then go to the next sheet and checks the 1.300 rows of my translation table and go to the next sheet, etc.
As I have 40 sheets, the process is taking to long and I´m looking for a way to do this quicker.
Any of you could improve this code or just give me another one that do what I need?
The code is the following.
Code:
Const lang1 As Long = 1 Const lang2 As Long = 2 Dim arr1 As Variant Dim arr2 As Variant Dim i As Long Dim lr As Long Dim ws As Worksheet Dim WS1 As Worksheet Set WS1 = Sheets("Guide") With ThisWorkbook.Worksheets("Translation") lr = .Cells(.Rows.Count, 1).End(xlUp).Row arr1 = .Range(.Cells(2, lang2), .Cells(lr, lang2)) arr2 = .Range(.Cells(2, lang1), .Cells(lr, lang1)) End With For Each ws In ThisWorkbook.Worksheets With ws Select Case (ws.Name) Case "Translation" Case Else For i = 1 To lr - 1 .Cells.SpecialCells(xlCellTypeConstants).Replace What:=arr1(i, 1), Replacement:=arr2(i, 1), LookAt:=xlWhole, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Next End Select End With Next
Thanks in advance!
Last edited: