I have this code and my question is, will it work on English version of excel? I mean local formulas will work on English version of excel? (ORAZ mean AND in my language).

When I put ORAZ it works only on my PC, but on English PC it doesn’t, when I put AND it doesn’t give error but it doesn’t work, any ideas how to help me ?

```
With Range("$H$6:$FH$50").FormatConditions _
.Add(xlExpression, xlFormula, "=ORAZ(H$7<=$G$7,(H$7+7)>$G$7)")
With .Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight2
.TintAndShade = 0.799981688894314
End With
End With
```

The problem is that you are just inserting a text within a cell, so it will only work if excel is set up for that language. Instead you can assign the worksheet function from VBA code like this:

```
ActiveCell = WorksheetFunction.And(H$7<=$G$7,(H$7+7)>$G$7)
```

This way Excel will translate the formula to the current language the user has set up.

### Answer：

I tested in my (Brazilian Portuguese) Excel 2013 and found that, indeed, `FormatConditions.Add()`

expects its formulas in the **localized version**. It doesn’t understand “canonical formulas” like `Range.Formula`

does.

The following should work, even though the method used to translate the formula isn’t the most proper ever:

```
Dim temp As Range
' The temp cell is just for translating our formula.
' Set it to some cell your sheet will never use.
Set temp = ActiveSheet.Range("Z1000")
temp.Formula = "=AND(E$1<=$E$2,(E$1+2)>$E$2)" ' use English formula here
With Range("$A$1:$D$4").FormatConditions _
.Add(Type:=xlExpression, Formula1:=temp.FormulaLocal)
With .Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight2
.TintAndShade = 0.799981688894314
End With
End With
Call temp.Clear ' do away with the temp cell
```

Note that I also removed the useless `xlFormula`

argument of the `.Add()`

call, and explicited the optional parameters names.

Also, after the fact I discovered that this question is a duplicate of this and this.

Tags: excelexcel, vba