简体   繁体   中英

VBA Macro not working on French excel

I have built a macro for my French counterparts, and it doesn't seem to want to work. I understand there are some functions that need to be changed, eg LEN becomes NBCAR (according to the website I found). After doing this it errors saying "Sub or function not defined" (in French) whilst highlighting NBCAR. In my version of the macro, LEN is not defined so its slightly frustrating. Is there a quick fix, perhaps a way to tell VBA to read the code in English?

Any help would be greatly appreciated.

Thank You

Code from my English Macro:

Application.ScreenUpdating = False
Dim sh1 As Worksheet, N As Long
Dim st As String
Dim rng1 As Range
Dim rng2 As Range
Dim rng3 As Range
Dim sPath As String
Set sh1 = Sheets("VTR - MASTER")
Dim R As Integer
Dim Z As Range
Dim VTR As String
Dim W As Integer
R = 1
W = 1
VTR = Sheets("VTR - INFO").Range("J1").Value

MsgBox "Select Destination To Save ORT CSV", vbInformation, "Select Destination"
    With Application.FileDialog(msoFileDialogFolderPicker)
    .AllowMultiSelect = False
    .Show

    If .SelectedItems.Count > 0 Then
        sPath = .SelectedItems(1)

' Filter Merchant ID

MERCHID = sh1.Cells(Rows.Count, "A").End(xlUp).Row

For i = 2 To MERCHID
    v = sh1.Cells(i, 1).Value
    If v <> "" Then
        st = st & v & ","
    End If
Next i
st = Mid(st, 1, Len(st) - 1)
Arr1 = Split(st, ",")

Sheets("VTR - DATA").Select
Sheets("VTR - DATA").AutoFilterMode = False
With Sheets("VTR - DATA").Range("A:Q")
    .AutoFilter Field:=2, Criteria1:=Arr1, Operator:=xlFilterValues
    .AutoFilter Field:=1, Criteria1:= _
    "<>SOR"
    End With


Set rng1 = Application.Intersect(ActiveSheet.UsedRange, Range("F:G,K:L"))
rng1.Offset(1, 0).SpecialCells(xlCellTypeVisible).Copy
Sheets("CSV").Cells(Rows.Count, "A").End(xlUp).Offset(1).PasteSpecial xlPasteValues
Application.CutCopyMode = False

Sheets("VTR - DATA").AutoFilterMode = False
Range("A1").Select

There is missing End If for:

If .SelectedItems.Count > 0

And End With for:

With Application.FileDialog(msoFileDialogFolderPicker)

After that it compiles OK. (Of course it does not run, because I do not have sheet with name "VTR - MASTER" and etc.)

If VBA editor shows an error by functions like LEN please check missing references in menu Tools - References. Sometimes missing references confuses VBA that it shows an error even by internal functions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM