Probleme de format date

Sanegone

XLDnaute Nouveau
Bonjour,


J'ai une date au format 04/05/11 dans une cellule excel.

Je tente de l'afficher dans une texte box le problème c'est que la date s'affiche au format 05/04/11 et non 04/05/11. j'ai tenter un :

FormatDateTime(TextBox2.Value, vbShortDate) = Cells(i, 5).Value

mais VB m’envoie bouler et réclame un Variant. Quelqu'un as une idée ?
 

Sanegone

XLDnaute Nouveau
Re : Probleme de format date

J'ai tester avec ta méthode mais toujours pareil, la date dans la cellule = 04/04/2011 date dans ma textbox 04/04/2011 pas de soucis.

Je la modifie en 05/04/2011 et dans la feuille excel apprait au format 04/05/2011 :'(


Code:
Private Sub ComboBox1_Change()
If val = 0 Then
VAR_NBR_AUTOMATE = Range("A65536").End(xlUp).Row
For i = 1 To VAR_NBR_AUTOMATE
    test1 = Cells(i, 1).Value
    test2 = ComboBox1.Value
    If test1 = test2 Then
        Frame3.TextBox1.Value = Cells(i, 1).Value
        Frame3.ComboBox5.Value = Cells(i, 2).Value
        Frame3.TextBox13.Value = Cells(i, 3).Value
        Frame3.ComboBox6.Value = Cells(i, 4).Value
        Frame3.TextBox2.Value = Cells(i, 5).Text
        Frame3.TextBox3.Value = Cells(i, 6).Value
        Frame3.TextBox4.Value = Cells(i, 7).Value
        Frame3.TextBox5.Value = Cells(i, 8).Value
        Frame3.TextBox7.Value = Cells(i, 9).Value
        Frame3.TextBox6.Text = FormatDateTime(Cells(i, 10).Value, vbShortTime)
        If Cells(i, 12).Value = "o" Then
            Frame3.CheckBox2.Value = True
        Else
            Frame3.CheckBox2.Value = False
        End If
        If Cells(i, 13).Value = "o" Then
            Frame3.CheckBox7.Value = True
        Else
            Frame3.CheckBox7.Value = False
        End If
        If Cells(i, 14).Value = "o" Then
            Frame3.CheckBox3.Value = True
        Else
            Frame3.CheckBox3.Value = False
        End If
        If Cells(i, 15).Value = "o" Then
            Frame3.CheckBox4.Value = True
        Else
            Frame3.CheckBox4.Value = False
        End If
        If Cells(i, 16).Value = "o" Then
            Frame3.CheckBox5.Value = True
        Else
            Frame3.CheckBox5.Value = False
        End If
        If Cells(i, 17).Value = "o" Then
            Frame3.CheckBox6.Value = True
        Else
            Frame3.CheckBox6.Value = False
        End If
        Label22.Caption = Cells(i, 18).Value
        TextBox12.Value = Cells(i, 18).Value
        Frame3.TextBox8.Value = Cells(i, 25).Value
        Frame3.TextBox10.Value = Cells(i, 26).Value
        Frame3.TextBox11.Value = Cells(i, 27).Value
    End If
Next i
End If
End Sub
 

Discussions similaires

Réponses
3
Affichages
353

Statistiques des forums

Discussions
312 345
Messages
2 087 487
Membres
103 557
dernier inscrit
gerard.messerlin68@orange