begin process at 2012 02 16 09:09:05
  Trouver un code source :
 
dans
 
Accueil > Forum > 

Archive Visual Basic & VB.NET

 > 

Archives Visual Basic

 > 

VBA

 > 

Simplifier un bout de code


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

Simplifier un bout de code

lundi 18 mars 2002 à 20:27:11 | Simplifier un bout de code

Baboune1

Salut,
Quelqu'un saurait me dire comment simplifier ce code :

FormCalendrier.Bouton1.Caption = Calendar(1, 1)
FormCalendrier.Bouton2.Caption = Calendar(1, 2)
FormCalendrier.Bouton3.Caption = Calendar(1, 3)
FormCalendrier.Bouton4.Caption = Calendar(1, 4)
FormCalendrier.Bouton5.Caption = Calendar(1, 5)
FormCalendrier.Bouton6.Caption = Calendar(1, 6)
FormCalendrier.Bouton7.Caption = Calendar(1, 7)
FormCalendrier.Bouton8.Caption = Calendar(2, 1)
FormCalendrier.Bouton9.Caption = Calendar(2, 2)
FormCalendrier.Bouton10.Caption = Calendar(2, 3)
FormCalendrier.Bouton11.Caption = Calendar(2, 4)
FormCalendrier.Bouton12.Caption = Calendar(2, 5)
FormCalendrier.Bouton13.Caption = Calendar(2, 6)
FormCalendrier.Bouton14.Caption = Calendar(2, 7)

FormCalendrier.Bouton X.Caption= Calendar(Y, Z)
ne fonctionne pas !

Merci de votre aide.
mardi 19 mars 2002 à 08:22:37 | Re : Simplifier un bout de code

Neo.balastik

Salut,

Essaye cela:

Dim Counter As Byte
Dim Y As Byte
Dim Z As Byte

Y = 1

For i = 1 To 14

If i > 7 Then Y = 2
If Z = 8 Then Z = 0

Z = Z + 1

FormCalendrier.Controls("Bouton" & Trim$(Str$(i))).Caption = Calendar(Y, Z)

Next i

Tchao

NéoB

-------------------------------
Réponse au message :
-------------------------------

Salut,
Quelqu'un saurait me dire comment simplifier ce code :

FormCalendrier.Bouton1.Caption = Calendar(1, 1)
FormCalendrier.Bouton2.Caption = Calendar(1, 2)
FormCalendrier.Bouton3.Caption = Calendar(1, 3)
FormCalendrier.Bouton4.Caption = Calendar(1, 4)
FormCalendrier.Bouton5.Caption = Calendar(1, 5)
FormCalendrier.Bouton6.Caption = Calendar(1, 6)
FormCalendrier.Bouton7.Caption = Calendar(1, 7)
FormCalendrier.Bouton8.Caption = Calendar(2, 1)
FormCalendrier.Bouton9.Caption = Calendar(2, 2)
FormCalendrier.Bouton10.Caption = Calendar(2, 3)
FormCalendrier.Bouton11.Caption = Calendar(2, 4)
FormCalendrier.Bouton12.Caption = Calendar(2, 5)
FormCalendrier.Bouton13.Caption = Calendar(2, 6)
FormCalendrier.Bouton14.Caption = Calendar(2, 7)

FormCalendrier.Bouton X.Caption= Calendar(Y, Z)
ne fonctionne pas !

Merci de votre aide.
mardi 19 mars 2002 à 12:05:00 | Re : Simplifier un bout de code

Schouly

Je serai de toi je créerai un tableau d'élément ...

Tu crée un Bouton et tu lui met l'index 1 ... ensuite

tu fais des copier coller de ton bouton ... ça donnera une succesion d'index. tu pourras l'utiliser comme :

FormCalendrier.Bouton(14).Caption = Calendar(2, 7)

FormCalendrier.Bouton(X).Caption = Calendar(2, 7)







-------------------------------
Réponse au message :
-------------------------------

Salut,

Essaye cela:

Dim Counter As Byte
Dim Y As Byte
Dim Z As Byte

Y = 1

For i = 1 To 14

If i > 7 Then Y = 2
If Z = 8 Then Z = 0

Z = Z + 1

FormCalendrier.Controls("Bouton" & Trim$(Str$(i))).Caption = Calendar(Y, Z)

Next i

Tchao

NéoB

-------------------------------
Réponse au message :
-------------------------------

Salut,
Quelqu'un saurait me dire comment simplifier ce code :

FormCalendrier.Bouton1.Caption = Calendar(1, 1)
FormCalendrier.Bouton2.Caption = Calendar(1, 2)
FormCalendrier.Bouton3.Caption = Calendar(1, 3)
FormCalendrier.Bouton4.Caption = Calendar(1, 4)
FormCalendrier.Bouton5.Caption = Calendar(1, 5)
FormCalendrier.Bouton6.Caption = Calendar(1, 6)
FormCalendrier.Bouton7.Caption = Calendar(1, 7)
FormCalendrier.Bouton8.Caption = Calendar(2, 1)
FormCalendrier.Bouton9.Caption = Calendar(2, 2)
FormCalendrier.Bouton10.Caption = Calendar(2, 3)
FormCalendrier.Bouton11.Caption = Calendar(2, 4)
FormCalendrier.Bouton12.Caption = Calendar(2, 5)
FormCalendrier.Bouton13.Caption = Calendar(2, 6)
FormCalendrier.Bouton14.Caption = Calendar(2, 7)

FormCalendrier.Bouton X.Caption= Calendar(Y, Z)
ne fonctionne pas !

Merci de votre aide.

mardi 19 mars 2002 à 12:10:48 | Re : Simplifier un bout de code

Neo.balastik

Salut,

Pour ton information, il s'agit de l'environnement Excel et non VB. Il n'est pas possible de créer des tableaux de contrôles dans Excel contrairement à VB...

Alors ma méthode reste d'actualité !

Tchao

NéoB



-------------------------------
Réponse au message :
-------------------------------

Je serai de toi je créerai un tableau d'élément ...

Tu crée un Bouton et tu lui met l'index 1 ... ensuite

tu fais des copier coller de ton bouton ... ça donnera une succesion d'index. tu pourras l'utiliser comme :

FormCalendrier.Bouton(14).Caption = Calendar(2, 7)

FormCalendrier.Bouton(X).Caption = Calendar(2, 7)







-------------------------------
Réponse au message :
-------------------------------

Salut,

Essaye cela:

Dim Counter As Byte
Dim Y As Byte
Dim Z As Byte

Y = 1

For i = 1 To 14

If i > 7 Then Y = 2
If Z = 8 Then Z = 0

Z = Z + 1

FormCalendrier.Controls("Bouton" & Trim$(Str$(i))).Caption = Calendar(Y, Z)

Next i

Tchao

NéoB

-------------------------------
Réponse au message :
-------------------------------

Salut,
Quelqu'un saurait me dire comment simplifier ce code :

FormCalendrier.Bouton1.Caption = Calendar(1, 1)
FormCalendrier.Bouton2.Caption = Calendar(1, 2)
FormCalendrier.Bouton3.Caption = Calendar(1, 3)
FormCalendrier.Bouton4.Caption = Calendar(1, 4)
FormCalendrier.Bouton5.Caption = Calendar(1, 5)
FormCalendrier.Bouton6.Caption = Calendar(1, 6)
FormCalendrier.Bouton7.Caption = Calendar(1, 7)
FormCalendrier.Bouton8.Caption = Calendar(2, 1)
FormCalendrier.Bouton9.Caption = Calendar(2, 2)
FormCalendrier.Bouton10.Caption = Calendar(2, 3)
FormCalendrier.Bouton11.Caption = Calendar(2, 4)
FormCalendrier.Bouton12.Caption = Calendar(2, 5)
FormCalendrier.Bouton13.Caption = Calendar(2, 6)
FormCalendrier.Bouton14.Caption = Calendar(2, 7)

FormCalendrier.Bouton X.Caption= Calendar(Y, Z)
ne fonctionne pas !

Merci de votre aide.


mardi 19 mars 2002 à 18:48:24 | Re : Simplifier un bout de code

Schouly


Excuse ...

j'ai vu nul part qu'il s'agissait de VBA ... mais si oui t'as entièrement raison ...


-------------------------------
Réponse au message :
-------------------------------

Salut,

Pour ton information, il s'agit de l'environnement Excel et non VB. Il n'est pas possible de créer des tableaux de contrôles dans Excel contrairement à VB...

Alors ma méthode reste d'actualité !

Tchao

NéoB



-------------------------------
Réponse au message :
-------------------------------

Je serai de toi je créerai un tableau d'élément ...

Tu crée un Bouton et tu lui met l'index 1 ... ensuite

tu fais des copier coller de ton bouton ... ça donnera une succesion d'index. tu pourras l'utiliser comme :

FormCalendrier.Bouton(14).Caption = Calendar(2, 7)

FormCalendrier.Bouton(X).Caption = Calendar(2, 7)







-------------------------------
Réponse au message :
-------------------------------

Salut,

Essaye cela:

Dim Counter As Byte
Dim Y As Byte
Dim Z As Byte

Y = 1

For i = 1 To 14

If i > 7 Then Y = 2
If Z = 8 Then Z = 0

Z = Z + 1

FormCalendrier.Controls("Bouton" & Trim$(Str$(i))).Caption = Calendar(Y, Z)

Next i

Tchao

NéoB

-------------------------------
Réponse au message :
-------------------------------

Salut,
Quelqu'un saurait me dire comment simplifier ce code :

FormCalendrier.Bouton1.Caption = Calendar(1, 1)
FormCalendrier.Bouton2.Caption = Calendar(1, 2)
FormCalendrier.Bouton3.Caption = Calendar(1, 3)
FormCalendrier.Bouton4.Caption = Calendar(1, 4)
FormCalendrier.Bouton5.Caption = Calendar(1, 5)
FormCalendrier.Bouton6.Caption = Calendar(1, 6)
FormCalendrier.Bouton7.Caption = Calendar(1, 7)
FormCalendrier.Bouton8.Caption = Calendar(2, 1)
FormCalendrier.Bouton9.Caption = Calendar(2, 2)
FormCalendrier.Bouton10.Caption = Calendar(2, 3)
FormCalendrier.Bouton11.Caption = Calendar(2, 4)
FormCalendrier.Bouton12.Caption = Calendar(2, 5)
FormCalendrier.Bouton13.Caption = Calendar(2, 6)
FormCalendrier.Bouton14.Caption = Calendar(2, 7)

FormCalendrier.Bouton X.Caption= Calendar(Y, Z)
ne fonctionne pas !

Merci de votre aide.



mercredi 20 mars 2002 à 21:14:35 | Merci pour votre aide

Baboune1

Tout est dans le titre

Comme d'habitude, il y a toujours quelqu'un pour aider un apprenti codeur dans le besoin.

Ne changer rien.


-------------------------------
Réponse au message :
-------------------------------


Excuse ...

j'ai vu nul part qu'il s'agissait de VBA ... mais si oui t'as entièrement raison ...


-------------------------------
Réponse au message :
-------------------------------

Salut,

Pour ton information, il s'agit de l'environnement Excel et non VB. Il n'est pas possible de créer des tableaux de contrôles dans Excel contrairement à VB...

Alors ma méthode reste d'actualité !

Tchao

NéoB



-------------------------------
Réponse au message :
-------------------------------

Je serai de toi je créerai un tableau d'élément ...

Tu crée un Bouton et tu lui met l'index 1 ... ensuite

tu fais des copier coller de ton bouton ... ça donnera une succesion d'index. tu pourras l'utiliser comme :

FormCalendrier.Bouton(14).Caption = Calendar(2, 7)

FormCalendrier.Bouton(X).Caption = Calendar(2, 7)







-------------------------------
Réponse au message :
-------------------------------

Salut,

Essaye cela:

Dim Counter As Byte
Dim Y As Byte
Dim Z As Byte

Y = 1

For i = 1 To 14

If i > 7 Then Y = 2
If Z = 8 Then Z = 0

Z = Z + 1

FormCalendrier.Controls("Bouton" & Trim$(Str$(i))).Caption = Calendar(Y, Z)

Next i

Tchao

NéoB

-------------------------------
Réponse au message :
-------------------------------

Salut,
Quelqu'un saurait me dire comment simplifier ce code :

FormCalendrier.Bouton1.Caption = Calendar(1, 1)
FormCalendrier.Bouton2.Caption = Calendar(1, 2)
FormCalendrier.Bouton3.Caption = Calendar(1, 3)
FormCalendrier.Bouton4.Caption = Calendar(1, 4)
FormCalendrier.Bouton5.Caption = Calendar(1, 5)
FormCalendrier.Bouton6.Caption = Calendar(1, 6)
FormCalendrier.Bouton7.Caption = Calendar(1, 7)
FormCalendrier.Bouton8.Caption = Calendar(2, 1)
FormCalendrier.Bouton9.Caption = Calendar(2, 2)
FormCalendrier.Bouton10.Caption = Calendar(2, 3)
FormCalendrier.Bouton11.Caption = Calendar(2, 4)
FormCalendrier.Bouton12.Caption = Calendar(2, 5)
FormCalendrier.Bouton13.Caption = Calendar(2, 6)
FormCalendrier.Bouton14.Caption = Calendar(2, 7)

FormCalendrier.Bouton X.Caption= Calendar(Y, Z)
ne fonctionne pas !

Merci de votre aide.






Cette discussion est classée dans : code, caption, calendar, simplifier, formcalendrier


Répondre à ce message

Sujets en rapport avec ce message

Modifier le Caption des boutons à la volée [ par Baboune1 ] Boujour,Comment peut on simplifier ceci en VBA Excel :FormCalendrier.Bouton1.Caption = Calendar(1, 1)FormCalendrier.Bouton2.Caption = Calendar(1, 2)Fo font pour l'impression d'un code barre [ par astridgall ] Bonjour,j'imprime un form avec un code barre juste pour un champ label. Dans un cas ca marche dans l'autre non ?Je suis sur vb6 et windows 98 l'imprim Besoin d'aide pour raccourcir un code : animation d'un label [ par maxwells ] Bonjour voici un code qui donne l'effet d'une animation dans un label : Dim Count as integerPrivate sub form_loadTimer1.enabled = trueTimer1.interval Transfert du Caption d'un label vers un autre. [ par Vivolenantais ] Comment code t-on ? Sachant que dans un même projet, j'ai deux feuilles différentes, avec un lien les reliant lors de l'exécution.Sur une des deux feu récupération de données de ma base [VB6] [ par petchy ] bonjour à tousIl y à quelques jours,j'ai posé une quetion sur le forum,concernant "l'affichage des données d'une listview dans des labels",Daniel m'a ** *Simplifier ce code *** [ par Heny ] Salut   S’il vous plais quelqu'un pourrait il m’aider a simplifier le code écris en rouge. Je l’utilisepour filtrer les données et pour faire le comp caption d'un button [ par nafee ] bonjour,je cherche un code qui donne le caption d'un contrôle (button) par exemple si le curseur de la sourie sur un button d'un programme exele code code [ par chrak ] Est-ce que je ne peux pas parcourir toutes les feuilles d'un projet pour savoir leurs captions J'est utiliser le code suivant : <p class=" racourcir du code vb6 [ par gpinkie ] bonjour a tous je voudrais raccourcire mon code Vb mais je n' redondance de code [ par Masco ] Bonjour,Je programme sous macro excel en VBAVoila mon soucis:J'utilise plusieurs (une dizaine) de label où je demande à l'utilisateur ce qu'il souhait


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

Photothèque

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,546 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales