Hello VBA experts!
I have previously received tremendous help here and I need your help again please.
I have a routine that I run to translate monthly excel files (code below).
I currently move the sheet "Words" to the workbook I wish to translate. My aim is to stop having to move the "Words" sheet every time I want to translate a workbook.
Also, my chart titles are linked to a cell. I know it is possible to tell the code to activate the chart and translate the title.
Your assistance is much appreciated. Thank you so much.
Peter
I have previously received tremendous help here and I need your help again please.
I have a routine that I run to translate monthly excel files (code below).
I currently move the sheet "Words" to the workbook I wish to translate. My aim is to stop having to move the "Words" sheet every time I want to translate a workbook.
Also, my chart titles are linked to a cell. I know it is possible to tell the code to activate the chart and translate the title.
Your assistance is much appreciated. Thank you so much.
Peter
Code:
Sub Translator()
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 Chrt As ChartObject
With ActiveWorkbook.Worksheets("Words")
lr = .Cells(.Rows.Count, 1).End(xlUp).Row
arr1 = .Range(.Cells(2, lang1), .Cells(lr, lang1))
arr2 = .Range(.Cells(2, lang2), .Cells(lr, lang2))
End With
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> "Words" Then
With ws
.UsedRange.Value = .UsedRange.Value
For I = 1 To lr - 1
.Cells.Replace what:=arr1(I, 1), replacement:=arr2(I, 1), LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Next I
End With
End If
Next ws
End Sub