View Full Version : Solved: Userform value problem

03-20-2011, 02:46 PM
I have a little UserForm designed to fill the numerical values ​​into the starting balance for the 3 accounts in an accounting sheet.

The userform has 3 text boxes for entering starting balance, and 3 command buttons (Register - Empty user form - Close).

In the text boxes I enter the amount that will be the beginning balance.
In Denmark we use a comma as decimal delimiter.
When the value is transferred to the sheet, Excel sees numbers with comma as if it were text.

If I enter the amount with sentences as decimal delimiter , Excel sees it as a decimal so it will be formatted correctly.

Here are the userforms VBA code:

Private Sub CommandButton1_Click()
Sheets("Ark2").Range("B2") = T1.Value
Sheets("Ark2").Range("B3") = T2.Value
Sheets("Ark2").Range("B4") = T3.Value

Sheets("Ark2").Range("D2") = T1.Value
Sheets("Ark2").Range("D3") = T2.Value
Sheets("Ark2").Range("D4") = T3.Value

End Sub

Private Sub CommandButton2_Click()
Me!T1 = ""
Me!T2 = ""
Me!T3 = ""
End Sub

Private Sub CommandButton3_Click()
End Sub.Select
What should I do to be able to insert the numbers in my language (Danish) and have them transferred correctly to the spreadsheet?
I am using Excel 2003.

03-20-2011, 03:19 PM
Sheets("Ark2").Range("B2") = csng(T1.Value)

03-20-2011, 03:54 PM
That works.