Zone de texte s'affiche le mois...:______" MSFl
Fermé
accent19811
Messages postés
105
Date d'inscription
mercredi 4 janvier 2012
Statut
Membre
Dernière intervention
28 mai 2023
-
5 janv. 2012 à 19:47
f894009 Messages postés 17181 Date d'inscription dimanche 25 novembre 2007 Statut Membre Dernière intervention 21 mars 2024 - 5 janv. 2012 à 20:29
f894009 Messages postés 17181 Date d'inscription dimanche 25 novembre 2007 Statut Membre Dernière intervention 21 mars 2024 - 5 janv. 2012 à 20:29
A voir également:
- Zone de texte s'affiche le mois...:______" MSFl
- Zone telechargement - Guide
- Le clavier de mon telephone ne s'affiche plus - Guide
- Corinne copie un texte sur le web et le colle dans un document avec l'option "texte non formaté" (aussi appelée "texte sans mise en forme"). qu'est-ce qui est conservé ? - Forum Bureautique
- Si cellule contient texte alors ✓ - Forum Excel
- Excel cellule couleur si condition texte - Guide
1 réponse
f894009
Messages postés
17181
Date d'inscription
dimanche 25 novembre 2007
Statut
Membre
Dernière intervention
21 mars 2024
1 701
5 janv. 2012 à 20:29
5 janv. 2012 à 20:29
re
'Affiche une date + NUM + Prix sur " MSFlexGrid1" V.B6
'Mais à condition..:
'Elle un zone de texte s'affiche le mois...:______
'-Date doit répéter à partir de "nombre mois".
'Si le zone texte "mois" égal par exemple: 10.
'Donc Num dans liste s'affiche: 1 jusqu'à 10.
'-Chaque fois plus 30 jours.
'Voir exemple suivant..:
'01---- 15/01/2012----500.00
'02---- 15/02/2012----500.00
'03---- 15/03/2012----500.00
'04---- 15/04/2012----500.00
'05---- 15/05/2012----500.00
Option Explicit
Dim Nb_Mois As Integer
Private Sub Form_Load()
MSFlexGrid1.Visible = False
Text1.Text = ""
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
'Controle chiffres
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 13 Then KeyAscii = 8
'Controle CR et un nombre
If KeyAscii = 13 And Text1.Text <> "" Then
Nb_Mois = CInt(Text1.Text)
'raz textbox
Text1.Text = ""
If Nb_Mois > 0 Then
Call Rempli_MSFlex
End If
End If
Text1.SetFocus
End Sub
Private Sub Rempli_MSFlex()
Dim Date_Maintenant, Date_Mois_Suivant, i
MSFlexGrid1.Visible = True
'MSFlexGrig a 2 colonnes et 6 ligne (Titre + 5 mois)
Me.MSFlexGrid1.Clear
Me.MSFlexGrid1.Cols = 4
MSFlexGrid1.Rows = Nb_Mois + 1
Date_Maintenant = Now
Date_Mois_Suivant = Date_Maintenant
' Ecriture du titre Colonne1
With MSFlexGrid1
.TextMatrix(0, 1) = "Num"
.TextMatrix(0, 2) = "Date"
.TextMatrix(0, 3) = "Prix"
'Ecriture Date Aujourd'hui Colonne1
.TextMatrix(1, 1) = "01"
.TextMatrix(1, 2) = Format(Date_Mois_Suivant, "DD/MM/YYYY")
.TextMatrix(1, 3) = "500.00"
'ecriture quatre mois suivants
For i = 2 To Nb_Mois
.TextMatrix(i, 1) = Format(i, "00")
Date_Mois_Suivant = Format(DateAdd("m", 1, Date_Mois_Suivant), "dd/mm/yyyy")
.TextMatrix(i, 2) = Format(Date_Mois_Suivant, "DD/MM/YYYY")
.TextMatrix(i, 3) = "500.00"
Next i
End With
End Sub
Entrez le nombre de mois dans la zone de texte
Bonne suite
'Affiche une date + NUM + Prix sur " MSFlexGrid1" V.B6
'Mais à condition..:
'Elle un zone de texte s'affiche le mois...:______
'-Date doit répéter à partir de "nombre mois".
'Si le zone texte "mois" égal par exemple: 10.
'Donc Num dans liste s'affiche: 1 jusqu'à 10.
'-Chaque fois plus 30 jours.
'Voir exemple suivant..:
'01---- 15/01/2012----500.00
'02---- 15/02/2012----500.00
'03---- 15/03/2012----500.00
'04---- 15/04/2012----500.00
'05---- 15/05/2012----500.00
Option Explicit
Dim Nb_Mois As Integer
Private Sub Form_Load()
MSFlexGrid1.Visible = False
Text1.Text = ""
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
'Controle chiffres
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 13 Then KeyAscii = 8
'Controle CR et un nombre
If KeyAscii = 13 And Text1.Text <> "" Then
Nb_Mois = CInt(Text1.Text)
'raz textbox
Text1.Text = ""
If Nb_Mois > 0 Then
Call Rempli_MSFlex
End If
End If
Text1.SetFocus
End Sub
Private Sub Rempli_MSFlex()
Dim Date_Maintenant, Date_Mois_Suivant, i
MSFlexGrid1.Visible = True
'MSFlexGrig a 2 colonnes et 6 ligne (Titre + 5 mois)
Me.MSFlexGrid1.Clear
Me.MSFlexGrid1.Cols = 4
MSFlexGrid1.Rows = Nb_Mois + 1
Date_Maintenant = Now
Date_Mois_Suivant = Date_Maintenant
' Ecriture du titre Colonne1
With MSFlexGrid1
.TextMatrix(0, 1) = "Num"
.TextMatrix(0, 2) = "Date"
.TextMatrix(0, 3) = "Prix"
'Ecriture Date Aujourd'hui Colonne1
.TextMatrix(1, 1) = "01"
.TextMatrix(1, 2) = Format(Date_Mois_Suivant, "DD/MM/YYYY")
.TextMatrix(1, 3) = "500.00"
'ecriture quatre mois suivants
For i = 2 To Nb_Mois
.TextMatrix(i, 1) = Format(i, "00")
Date_Mois_Suivant = Format(DateAdd("m", 1, Date_Mois_Suivant), "dd/mm/yyyy")
.TextMatrix(i, 2) = Format(Date_Mois_Suivant, "DD/MM/YYYY")
.TextMatrix(i, 3) = "500.00"
Next i
End With
End Sub
Entrez le nombre de mois dans la zone de texte
Bonne suite