Link to home
Start Free TrialLog in
Avatar of boukaka
boukakaFlag for Canada

asked on

Convert Date to French on button click

Hi all, I have a range that points to a cell that contains a Date. The range is called Period_End_Date, I have a button that switches the language from English to French and vice versa. I need to be able to change the date format to French / English on the fly, can someone show me how to do that? My button code is below.
Public Sub LangGetSet(source As Integer)
 'scroll through Language sheet and check against ID passed in
    If source = 1 Then
        If language = "English" Then
            language = "French"
        'set date format of Period_End_Date to French (i.e. 20 Mai 2011)

        ElseIf language = "French" Then
            language = "English"
        'set date format of Period_End_Date to English (i.e 20 May 2011)
        End If
    End If
End Sub

Open in new window

Avatar of Christian de Bellefeuille
Christian de Bellefeuille
Flag of Canada image

What do you mean by "On the fly"?  Without pressing the button?

You could trap a worksheet_change event, and check if the target correspond to your range.  If it correspond, then you need to know in which language you are displaying the date at the moment...
Avatar of wchh

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of boukaka


Thanks so much, this works beautifully.