Hi all
I have a bit of Code to prepare and Format a worksheet. Allmost all is working.
I need to be sure that it is working with Swiss and English language of Excel. The problem is, that the Excel-Functions are different in the languages.
In my code I want to insert for exaple =ROUND(RC[-1]*(RC[1]/100),2) into my sheet. in German the Function is called RUNDEN.
So I thought to check the language and then create the function
In sert to Excel Sheet like this:
.FormulaR1C1 = "=" & fctReturnFunction(Round) & "(RC[-1]*(RC[1]/100),2)"
The Code for the VBE-Function:
Function fctReturnFunction(bytFunction As enuFunctions)
Dim intLanguage As Integer
Dim strCode As String
intLanguage = Application.LanguageSettings.LanguageID(msoLanguageIDUI)
Select Case intLanguage
Case 1031 'Deutsch
Select Case bytFunction
Case Round
strCode = "RUNDEN"
End Select
Case 1033
Se lect Case bytFunction
Case Round
strCode = "ROUND"
End Select
End Select
fctReturnFunction = strCode
End Function
This works fine and it creates the correct Excel-Function. It is working with the English version.
BUT not with the German Version. It gives the correct Excel-Function
But it shows (at)NAME?. When I go to the Cell with the Excel-Code, Press F2 to edit and Click Enter without changing anything the Function is working normaly and the (at)NAME? is gone. This means the Excel-Function is correct. So I need to enter each Cell with a function, Press Edit and Enter... I do not know how this can happen, especially when the English version is working as it should.
The calculation is automatic and recalculation does not help
Do you have any idea?
Thank you
Thomas
Bookmarks