XL 2019 Afficher format date m-yyyy et myyyy

eCHO

XLDnaute Junior
bonjour
j'ai 2 textbox une pour Réf et l'outre Numéro

Sans titre.jpg


et voici mon code VBA

VB:
Private Sub CommandButton1_Click()

Me.TextBox3.value = "BTQ N°: " & Me.N_Mag.value & "/" & Me.Cmb_Suite.value & " Du " & Me.Periode_Non_Payer.value & " Au " & DateAdd("m", Me.TextBox1.value, Periode_Non_Payer.value)
Me.TextBox4.value = Me.N_Mag.value & DateAdd("m", Me.TextBox1.value, Periode_Non_Payer.value)

Mon souci ci que pour numéro il ne doit pas contenir des caractère spécial seulement des numéros par exemple N_Mag&myyyy (55102021)
et pour réf la date Au il doit être afficher m-yyyy
merci d'avance
 

flc13090

XLDnaute Nouveau
Salut
Une solution
VB:
Private Sub CommandButton1_Click()
Dim xlWbk As Workbook
Dim xlWsh As Worksheet

Set xlWbk = ThisWorkbook
Set xlWsh = xlWbk.Worksheets("Feuil1")

Me.TextBox1 = "BTQ N°: " & xlWsh.Range("P2") & " Du " & Format(xlWsh.Range("Q2"), "mm-yyyy") & " Au " & Format(xlWsh.Range("R2"), "mm-yyyy")
Me.TextBox2 = xlWsh.Range("Q2")
Me.TextBox3 = xlWsh.Range("R2")
Me.TextBox4 = xlWsh.Range("P2") & Format(xlWsh.Range("R2"), "mmyyyy")

End Sub
20220824_3.jpg
 

Discussions similaires

Réponses
3
Affichages
373

Statistiques des forums

Discussions
312 755
Messages
2 091 711
Membres
105 054
dernier inscrit
uzaoui