IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Macros et VBA Excel Discussion :

problème label.caption à definir


Sujet :

Macros et VBA Excel

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Profil pro
    Inscrit en
    Septembre 2006
    Messages
    268
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2006
    Messages : 268
    Par défaut
    bonjour
    je voudrais affecter la valeur d'une cellule à un label
    j'ai ecris le code suivant mais ca ne fonctionne pas
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    UserForm5.Label51.Caption = Range("eg142")
    merci pour votre aide

  2. #2
    Membre Expert Avatar de laetitia
    Profil pro
    Inscrit en
    Décembre 2002
    Messages
    1 281
    Détails du profil
    Informations personnelles :
    Âge : 35
    Localisation : France

    Informations forums :
    Inscription : Décembre 2002
    Messages : 1 281
    Par défaut
    bonsoir fmris le forum tu la mis ou cette ligne de code???

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    Private Sub UserForm_Initialize()
    Label51.Caption = Range("eg142")
    End Sub

  3. #3
    Membre éclairé
    Profil pro
    Inscrit en
    Septembre 2006
    Messages
    268
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2006
    Messages : 268
    Par défaut
    ci joint le code avec l'erreur
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    Private Sub OptionButton7_Click()
    
    '**********mets la config par defauten HBW
        TextBox68.Visible = True
        TextBox104.Visible = True
        
        Label35.Visible = True
        Label41.Visible = True
        TextBox105.Visible = False
        Label66.Visible = False
        
        Frame12.Visible = False
        
        UserForm5.Label42.Visible = True
        UserForm5.Label43.Visible = True
        UserForm5.Label44.Visible = True
        UserForm5.Label45.Visible = True
        UserForm5.Label46.Visible = True
        UserForm5.Label47.Visible = True
        UserForm5.Label48.Visible = True
        UserForm5.Label49.Visible = True
        
        UserForm5.Label50.Visible = True
        UserForm5.Label51.Visible = True
        UserForm5.Label52.Visible = True
        UserForm5.Label53.Visible = True
        UserForm5.Label54.Visible = True
        UserForm5.Label55.Visible = True
        UserForm5.Label56.Visible = True
        UserForm5.Label57.Visible = True
        
        UserForm5.Label58.Visible = True
        UserForm5.Label59.Visible = True
        UserForm5.Label60.Visible = True
        UserForm5.Label61.Visible = True
        UserForm5.Label62.Visible = True
        UserForm5.Label63.Visible = True
        UserForm5.Label64.Visible = True
        UserForm5.Label65.Visible = True
        
        UserForm5.Label10.Caption = "Echelle (µm)"
        UserForm5.Label11.Caption = "Mes 1 (HBW)"
        UserForm5.Label12.Caption = "Mes 2 (HBW)"
        UserForm5.Label14.Caption = "Mes 3 (HBW)"
        '***********laisse apparaitre les nouvelles textbox
        
        
        
        
        'Range("if7") = ""
        UserForm5.TextBox11.ControlSource = "ep142"
        UserForm5.TextBox12.ControlSource = "ep143"
        UserForm5.TextBox13.ControlSource = "ep144"
        UserForm5.TextBox14.ControlSource = "ep145"
        UserForm5.TextBox15.ControlSource = "ep146"
        UserForm5.TextBox16.ControlSource = "ep147"
        UserForm5.TextBox17.ControlSource = "ep148"
        
        UserForm5.TextBox18.ControlSource = "eq142"
        UserForm5.TextBox19.ControlSource = "eq143"
        UserForm5.TextBox20.ControlSource = "eq144"
        UserForm5.TextBox21.ControlSource = "eq145"
        UserForm5.TextBox22.ControlSource = "eq146"
        UserForm5.TextBox23.ControlSource = "eq147"
        UserForm5.TextBox24.ControlSource = "eq148"
            
        UserForm5.TextBox25.ControlSource = "er142"
        UserForm5.TextBox26.ControlSource = "er143"
        UserForm5.TextBox27.ControlSource = "er144"
        UserForm5.TextBox28.ControlSource = "er145"
        UserForm5.TextBox29.ControlSource = "er146"
        UserForm5.TextBox30.ControlSource = "er147"
        UserForm5.TextBox31.ControlSource = "er148"
        
    '**********mets les labels en config HBW
    
        UserForm5.Label42.Caption = "Mes 1 (HBW)"
        UserForm5.Label50.Caption = "Mes 2 (HBW)"
        UserForm5.Label58.Caption = "Mes 3 (HBW)"
        
        Range("ef142") = UserForm5.Label43.Caption
        
        UserForm5.Label44.Caption = "ef143"
        UserForm5.Label45.Caption = Range("ef144").Select
        
        UserForm5.Label46.Caption = Range("ef145")
        UserForm5.Label47.Caption = Range("ef146")
        UserForm5.Label48.Caption = Range("ef147")
        UserForm5.Label49.Caption = Range("ef148")
        
        UserForm5.Label51.Caption = Range("eg142")
        UserForm5.Label52.Caption = Range("eg143")
        UserForm5.Label53.Caption = Range("eg144")
        UserForm5.Label54.Caption = Range("eg145")
        UserForm5.Label55.Caption = Range("eg146")
        UserForm5.Label56.Caption = Range("eg147")
        UserForm5.Label57.Caption = Range("eg148")
        
        UserForm5.Label59.Caption = Range("eh142")
        UserForm5.Label60.Caption = Range("eh143")
        UserForm5.Label61.Caption = Range("eh144")
        UserForm5.Label62.Caption = Range("eh145")
        UserForm5.Label63.Caption = Range("eh146")
        UserForm5.Label64.Caption = Range("eh147")
        UserForm5.Label65.Caption = Range("eh148")
       
       
        
        
        
        
        
    End Sub

  4. #4
    Membre Expert Avatar de rvtoulon
    Homme Profil pro
    Agent Technique
    Inscrit en
    Mars 2009
    Messages
    1 042
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Agent Technique
    Secteur : Santé

    Informations forums :
    Inscription : Mars 2009
    Messages : 1 042
    Par défaut
    Bsr, fmris, laetitia,
    et en rajoutant un .value ex:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Label51.Caption = Range("eg142").Value
    A+

  5. #5
    Membre éclairé
    Profil pro
    Inscrit en
    Septembre 2006
    Messages
    268
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2006
    Messages : 268
    Par défaut
    j'ai essaye sans succes...
    idem pour address

  6. #6
    Expert éminent Avatar de mercatog
    Homme Profil pro
    Inscrit en
    Juillet 2008
    Messages
    9 435
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Autre

    Informations forums :
    Inscription : Juillet 2008
    Messages : 9 435
    Par défaut
    c'est quoi cet intrus?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    UserForm5.Label45.Caption = Range("ef144").Select
    Que fait le Select?

  7. #7
    Membre Expert Avatar de rvtoulon
    Homme Profil pro
    Agent Technique
    Inscrit en
    Mars 2009
    Messages
    1 042
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Agent Technique
    Secteur : Santé

    Informations forums :
    Inscription : Mars 2009
    Messages : 1 042
    Par défaut
    Re, j'ai essayé avec un option buton et un label le code fonctionne.
    A quoi sert le select?

    EDIT: Bsr Mercatog, dsl j'ai pas vu ton message

  8. #8
    Membre éclairé Avatar de Basicnav
    Profil pro
    Inscrit en
    Février 2008
    Messages
    245
    Détails du profil
    Informations personnelles :
    Âge : 52
    Localisation : France, Nord (Nord Pas de Calais)

    Informations forums :
    Inscription : Février 2008
    Messages : 245
    Par défaut
    Salut

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    UserForm1.Label1.Caption = Sheets("Feuil1").Range("a2").Value
    Userform1.Show
    Te convient-il ?

  9. #9
    Membre expérimenté
    Profil pro
    Inscrit en
    Avril 2008
    Messages
    226
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2008
    Messages : 226
    Par défaut
    Hello le fil,

    Voici un classeur démo.

    Bye, Anto.
    Fichiers attachés Fichiers attachés

Discussions similaires

  1. [pstricks] Label caption
    Par ricololo dans le forum Mise en forme
    Réponses: 1
    Dernier message: 03/10/2007, 17h02
  2. Tabular + (Label & Caption) ?
    Par Surikat14 dans le forum Tableaux - Graphiques - Images - Flottants
    Réponses: 3
    Dernier message: 20/06/2007, 14h04
  3. [FLASH 8] Problème label.text
    Par nounetmasque dans le forum Flash
    Réponses: 3
    Dernier message: 03/09/2006, 17h58
  4. [VBA-E] label.caption en fonction d'un combobox
    Par max_c dans le forum Macros et VBA Excel
    Réponses: 7
    Dernier message: 16/08/2006, 14h18
  5. label à caption défilante
    Par ulysse66x dans le forum Composants VCL
    Réponses: 2
    Dernier message: 29/06/2003, 21h01

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo