VBA code to translate chart titles

yaacoubp

New Member
Joined
Feb 1, 2022
Messages
7
Office Version
  1. 365
Platform
  1. Windows
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

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
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,214,791
Messages
6,121,611
Members
449,038
Latest member
apwr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top