I have a drop down box, the items are depending on the regional settings:
Private Sub UserForm_Initialize()
Select Case Application.International(XlApplicationInternational.xlCountryCode)
Case 1: 'English
With ComboBox1
.AddItem "January"
...etc
End With
Case 36: 'Hungarian
With ComboBox1
.AddItem "Január"
...etc
End with
Case 49: 'German
With ComboBox1
.AddItem "Januar"
...etc
End with
End Select
End Sub
Later I use the selected value in this code:
Year_1 = 2017 'integer
Day_1 = 1 'integer
Date_from_userform = CDate(Year_1 & "-" & UserForm1.ComboBox1.Value & "-" & Day_1) 'date
In German environment, it works perfect, but I tested in Hungarian environment, and I get every time type mismatch.
The Cdate does not accept the 2017-Január-1. (Th excel was Hungarian)Why?
If the month depends on the regional settings, it should work... (Or should I convert the Values from the dropdownbox into numbers?)