Précédent   Forum des professionnels en informatique > Logiciels > Microsoft Office > Excel > Macros et VBA Excel
Macros et VBA Excel Vos questions relatives aux macros Excel, à l'utilisation de VBA et à l'automatisation de vos classeurs Excel.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 15/12/2011, 19h14   #1
Invité de passage
 
Homme
Étudiant
Inscription : décembre 2011
Messages : 14
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : Rwanda

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : décembre 2011
Messages : 14
Points : 4
Points : 4
Par défaut remplecement des mots dans le meme colonne

bonsoir,toujours je reviens au question de remplecement de colonnes:
maintenant je veux parler à propos de de userform qui contient 5 textbox un pour la langue" kinyarwanda" l'autre equivalent en "Englais" l'autre equivalent en "Francais" et deux qui restent c'est pour les terminaison en KINYARWANDA.et pour chaque textbox il ya un checkbox pouir desactiver le textbox quand il n'est pas desiré.

voici comment est le probleme alors: lorsque j'entre le mots en kinyarwanda jusque et leur equivalent en Anglais et en francais, jusque donc au dernier text box,il n'ya pas un probleme,ils se stock bein dans l'excel,mais si je saute le premier text box pour commencer avec le deuxieme,j'entre la premiere ligne quand j'entre le deuxieme, ce dernier remplece la premiere et comme ca c'est un problem.
voici mes codes:

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 
Private Sub cmdClose_Click()
Unload Me
End Sub
 
Private Sub cmdValidate_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Records")
 
'find rows in database
iRow = ws.Cells(Rows.Count, 1) _
  .End(xlUp).Offset(1, 0).Row
iRow = ws.Cells(Rows.Count, 2) _
  .End(xlUp).Offset(1, 0).Row
iRow = ws.Cells(Rows.Count, 3) _
  .End(xlUp).Offset(1, 0).Row
iRow = ws.Cells(Rows.Count, 4) _
  .End(xlUp).Offset(1, 0).Row
iRow = ws.Cells(Rows.Count, 5) _
  .End(xlUp).Offset(1, 0).Row
 
'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtKiny.Value
ws.Cells(iRow, 2).Value = Me.txtTermGA.Value
ws.Cells(iRow, 3).Value = Me.txtTermTseZe.Value
ws.Cells(iRow, 4).Value = Me.txtEng.Value
ws.Cells(iRow, 5).Value = Me.txtFre.Value
 
'clear the data
Me.txtKiny.Value = ""
Me.txtTermGA.Value = ""
Me.txtTermTseZe.Value = ""
Me.txtEng.Value = ""
Me.txtFre.Value = ""
Me.txtKiny.SetFocus
 
 
 
End Sub
 
Private Sub chkKiny_Click()
txtKiny.Enabled = (chkKiny.Value = vbChecked)
End Sub
Private Sub chkTermGa_Click()
txtTermGA.Enabled = (chkTermGa.Value = vbChecked)
End Sub
Private Sub chkTermTseZe_Click()
txtTermTseZe.Enabled = (chkTermTseZe.Value = vbChecked)
End Sub
 
Private Sub chkEng_Click()
txtEng.Enabled = (chkEng.Value = vbChecked)
End Sub
Private Sub chkFre_Click()
txtFre.Enabled = (chkFre.Value = vbChecked)
End Sub
 
Private Sub txtTermGa_Exit(ByVal Cancel As MSForms.ReturnBoolean)
 
 If Right(txtTermGA.Text, 2) <> "ga" Then Cancel = True
 End Sub
 
 Private Sub txtTermTseZe_Exit(ByVal Cancel As MSForms.ReturnBoolean)
  If (Right(txtTermTseZe.Text, 2) <> "ze") And (Right(txtTermTseZe.Text, 3) <> "tse") And (Right(txtTermTseZe.Text, 2) <> "ye") And (Right(txtTermTseZe.Text, 2) <> "je") And (Right(txtTermTseZe.Text, 2) <> "we") And (Right(txtTermTseZe.Text, 2) <> "se") Then Cancel = True
 
 End Sub
voici l'attachment de mon formulaire.
j'ai essayé de changer et utiliser le Select Case mais ça n'est va pas, en tout cas quelque peut m'aider merci.
Fichiers attachés
Type de fichier : xls Task1.xls (61,5 Ko, 2 affichages)
jeph.net est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 15/12/2011, 20h12   #2
Expert Confirmé Sénior
 
Avatar de mercatog
 
Inscription : juillet 2008
Messages : 5 848
Détails du profil
Informations forums :
Inscription : juillet 2008
Messages : 5 848
Points : 13 907
Points : 13 907
Ne fais pas n'importe quoi
Étudie d'abord ce qu'on te donne pour comprendre
Code :
1
2
3
4
5
6
7
8
9
10
11
12
Private Sub cmdValidate_Click()
Dim iRow As Long
 
With Worksheets("Records")
    iRow = .Range("A1").CurrentRegion.Rows.Count + 1
    .Cells(iRow, 1) = Me.txtKiny.Value
    .Cells(iRow, 2) = Me.txtTermGA.Value
    .Cells(iRow, 3) = Me.txtTermTseZe.Value
    .Cells(iRow, 4) = Me.txtFre.Value
    .Cells(iRow, 5) = Me.txtEng.Value
End With
End Sub
__________________
Cordialement.
mercatog est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 15/12/2011, 21h12   #3
Expert Confirmé Sénior
 
Homme Daniel
aucune
Inscription : septembre 2011
Messages : 2 004
Détails du profil
Informations personnelles :
Nom : Homme Daniel
Localisation : France, Seine et Marne (Île de France)

Informations professionnelles :
Activité : aucune

Informations forums :
Inscription : septembre 2011
Messages : 2 004
Points : 4 037
Points : 4 037
Bonjour,

Remplace le début de la macro cmdValidate_Click par :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Private Sub cmdValidate_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Records")
 
'find rows in database
iRow = ws.[A:E].Find("*", , , , xlByRows, xlPrevious).Offset(1).Row
 
'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtKiny.Value
ws.Cells(iRow, 2).Value = Me.txtTermGA.Value
ws.Cells(iRow, 3).Value = Me.txtTermTseZe.Value
ws.Cells(iRow, 4).Value = Me.txtEng.Value
ws.Cells(iRow, 5).Value = Me.txtFre.Value
__________________
Cordialement.

Daniel

Citation:
La plus perdue de toutes les journées est celle où l'on n'a pas ri.
Chamfort
Daniel.C est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/12/2011, 14h20   #4
Invité de passage
 
Homme
Étudiant
Inscription : décembre 2011
Messages : 14
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : Rwanda

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : décembre 2011
Messages : 14
Points : 4
Points : 4
Par défaut adjustement de ligne

bonjour!je m'excuse beaucoup mercatog,oui je doit lire,mais tout simplement je suis nouveau en visual basic et j'etudie a travers le net,don je pas un prof.j'apprecie l'aide que vous me donnez ca m'aide d'avance.mais voici le problem que je remarque encore pour mon formulaire a propos de remplacement de ligne.le problem de remplecement de ligne est resolu mais le problem qui reste est que si la premiere colonne est remplie,et si je veux commence a ecrire a partir de la deuxieme colonne, donc le terme equivalent de celle de la premiere colone premiere ca commence part la ou la premiere colonne termine donc ce que j'ecris toujour commence la ou il ya la ligne vide.par example si A1 il ya quelque chose,ce que j'ecris va commence par A2 ainsi de suite,alors que j'alais ecrire dans B2 le terme equivalent a A2 dans une autre langue.donc je voulais copier les mots dans une langue dans premiere colonne et ecrire leur equivalent dans une autre colonne.et c'est pas ainsi,ca sote et ca commence ou les mots de la premiere colone termine donc la ou il y aura une ligne vide.voici ce que j'avait essaiye de faire:

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
 
 
Private Sub cmdClose_Click()
Unload Me
End Sub
 
Private Sub cmdValidate_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Records")
 
 
With Worksheets("Records")
'ca doit commence a partir de la deuxieme colone premiere ligne
    iRow = .Range("B1").CurrentRegion.Rows.Count + 1
    '.Cells(iRow, 1) = Me.txtKiny.Value
    .Cells(iRow, 2) = Me.txtTermGA.Value
    .Cells(iRow, 3) = Me.txtTermTseZe.Value
    .Cells(iRow, 4) = Me.txtFre.Value
    .Cells(iRow, 5) = Me.txtEng.Value
End With
End Sub
 
Private Sub chkKiny_Click()
txtKiny.Enabled = (chkKiny.Value = vbChecked)
End Sub
Private Sub chkTermGa_Click()
txtTermGA.Enabled = (chkTermGa.Value = vbChecked)
End Sub
Private Sub chkTermTseZe_Click()
txtTermTseZe.Enabled = (chkTermTseZe.Value = vbChecked)
End Sub
 
Private Sub chkEng_Click()
txtEng.Enabled = (chkEng.Value = vbChecked)
End Sub
Private Sub chkFre_Click()
txtFre.Enabled = (chkFre.Value = vbChecked)
End Sub
 
Private Sub txtTermGa_Exit(ByVal Cancel As MSForms.ReturnBoolean)
 
 If Right(txtTermGA.Text, 2) <> "ga" Then Cancel = True
 End Sub
 
 Private Sub txtTermTseZe_Exit(ByVal Cancel As MSForms.ReturnBoolean)
  If (Right(txtTermTseZe.Text, 2) <> "ze") And (Right(txtTermTseZe.Text, 3) <> "tse") And (Right(txtTermTseZe.Text, 2) <> "ye") And (Right(txtTermTseZe.Text, 2) <> "je") And (Right(txtTermTseZe.Text, 2) <> "we") And (Right(txtTermTseZe.Text, 2) <> "se") Then Cancel = True
 
 End Sub
exemple du de bugs se trouve dans l'excel doc dans l'attachment
merci encore de m'entendre.
Fichiers attachés
Type de fichier : xls Task1.xls (149,5 Ko, 1 affichages)
jeph.net est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 05h21.


 
 
 
 
Partenaires

Hébergement Web