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 en VBA pour Excel


Sujet :

Macros et VBA Excel

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2012
    Messages
    20
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

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

    Informations forums :
    Inscription : Avril 2012
    Messages : 20
    Par défaut Problème en VBA pour Excel
    Bonjour à tous ,
    Je suis un débutant en VBA et je doit écrire une Macro qui me permet d’automatiser ce que j’ai l’abitude de faire avec les clic manuels. Voila mon problème.Je dois écrire un programe qui me permet de classer un fichier Excel en fonction des variables que contient le fichier et les différent projets dans lesquel les variables sont utilisées.
    J'ai joint à ce problème un fichier Excel dans lequel la 1ere feuille est celle en désordre et le seconde feuille est le fichier. Donc j'ai commencé a classer manuellement.
    J'ai essayé d'automatiser ce classement avec les Macros mais cela est trop limité et ça fait deja 1mois que je cherche comment faire une application qui va me gérer ce processus mais je n'y arrive vraiment pas.
    Voici ce que j'ai déjà pu faire .

    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
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    Sub Makro1()
    '
    ' Makro1 Makro
     
        Range("B3").Select
        ActiveCell.FormulaR1C1 = "Iv_volt = 4;" & Chr(10) & "Card = 8;" & Chr(10) & "Ampli = 7Hz;"
        With ActiveCell.Characters(Start:=1, Length:=35).Font
            .Name = "Calibri"
            .FontStyle = "Standard"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ThemeColor = xlThemeColorLight1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontMinor
        End With
        Sheets("Tabelle2").Select
        Range("A2").Select
        ActiveCell.FormulaR1C1 = "Iv_volt"
        Sheets("Tabelle1").Select
        Range("E3").Select
        ActiveCell.FormulaR1C1 = _
            "Hardw.2x" & Chr(10) & "Hadrw.3.8" & Chr(10) & "Hardw.1.2" & Chr(10) & "Hardw.9.0" & Chr(10) & "Hardw.0.8" & Chr(10) & "Hardw.7.9"
        With ActiveCell.Characters(Start:=1, Length:=58).Font
            .Name = "Calibri"
            .FontStyle = "Standard"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ThemeColor = xlThemeColorLight1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontMinor
        End With
        Sheets("Tabelle2").Select
        Range("B2").Select
        ActiveCell.FormulaR1C1 = _
            "Hardw.2x" & Chr(10) & "Hadrw.3.8" & Chr(10) & "Hardw.1.2" & Chr(10) & "Hardw.9.0" & Chr(10) & "Hardw.0.8" & Chr(10) & "Hardw.7.9"
        With ActiveCell.Characters(Start:=1, Length:=58).Font
            .Name = "Calibri"
            .FontStyle = "Standard"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ThemeColor = xlThemeColorLight1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontMinor
        End With
        Sheets("Tabelle1").Select
        Range("A3").Select
        ActiveCell.FormulaR1C1 = "Sozb1908"
        Sheets("Tabelle2").Select
        Range("C2").Select
        ActiveCell.FormulaR1C1 = "Sozb"
        Sheets("Tabelle1").Select
        Range("B3").Select
        ActiveCell.FormulaR1C1 = "Iv_volt = 4;" & Chr(10) & "Card = 8;" & Chr(10) & "Ampli = 7Hz;"
        With ActiveCell.Characters(Start:=1, Length:=35).Font
            .Name = "Calibri"
            .FontStyle = "Standard"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ThemeColor = xlThemeColorLight1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontMinor
        End With
        Sheets("Tabelle2").Select
        Range("A3").Select
        ActiveCell.FormulaR1C1 = "Card"
        Sheets("Tabelle1").Select
        Range("E3").Select
        ActiveCell.FormulaR1C1 = _
            "Hardw.2x" & Chr(10) & "Hadrw.3.8" & Chr(10) & "Hardw.1.2" & Chr(10) & "Hardw.9.0" & Chr(10) & "Hardw.0.8" & Chr(10) & "Hardw.7.9"
        With ActiveCell.Characters(Start:=1, Length:=58).Font
            .Name = "Calibri"
            .FontStyle = "Standard"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ThemeColor = xlThemeColorLight1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontMinor
        End With
        Sheets("Tabelle2").Select
        Range("B3").Select
        ActiveCell.FormulaR1C1 = _
            "Hardw.2x" & Chr(10) & "Hadrw.3.8" & Chr(10) & "Hardw.1.2" & Chr(10) & "Hardw.9.0" & Chr(10) & "Hardw.0.8" & Chr(10) & "Hardw.7.9"
        With ActiveCell.Characters(Start:=1, Length:=58).Font
            .Name = "Calibri"
            .FontStyle = "Standard"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ThemeColor = xlThemeColorLight1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontMinor
        End With
        Sheets("Tabelle1").Select
        Range("A3").Select
        ActiveCell.FormulaR1C1 = "Sozb1908"
        Sheets("Tabelle2").Select
        Range("C3").Select
        ActiveCell.FormulaR1C1 = "Sozb"
        Sheets("Tabelle1").Select
        Range("B3").Select
        ActiveCell.FormulaR1C1 = "Iv_volt = 4;" & Chr(10) & "Card = 8;" & Chr(10) & "Ampli = 7Hz;"
        With ActiveCell.Characters(Start:=1, Length:=35).Font
            .Name = "Calibri"
            .FontStyle = "Standard"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ThemeColor = xlThemeColorLight1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontMinor
        End With
        Sheets("Tabelle2").Select
        Range("A4").Select
        ActiveCell.FormulaR1C1 = "Ampli "
        Sheets("Tabelle1").Select
        Range("E3").Select
        ActiveCell.FormulaR1C1 = _
            "Hardw.2x" & Chr(10) & "Hadrw.3.8" & Chr(10) & "Hardw.1.2" & Chr(10) & "Hardw.9.0" & Chr(10) & "Hardw.0.8" & Chr(10) & "Hardw.7.9"
        With ActiveCell.Characters(Start:=1, Length:=58).Font
            .Name = "Calibri"
            .FontStyle = "Standard"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ThemeColor = xlThemeColorLight1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontMinor
        End With
        Sheets("Tabelle2").Select
        Range("B4").Select
        ActiveCell.FormulaR1C1 = _
            "Hardw.2x" & Chr(10) & "Hadrw.3.8" & Chr(10) & "Hardw.1.2" & Chr(10) & "Hardw.9.0" & Chr(10) & "Hardw.0.8" & Chr(10) & "Hardw.7.9"
        With ActiveCell.Characters(Start:=1, Length:=58).Font
            .Name = "Calibri"
            .FontStyle = "Standard"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ThemeColor = xlThemeColorLight1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontMinor
        End With
        Sheets("Tabelle1").Select
        Range("A3").Select
        ActiveCell.FormulaR1C1 = "Sozb1908"
        Sheets("Tabelle2").Select
        Range("C4").Select
        ActiveCell.FormulaR1C1 = "Sozb"
        Sheets("Tabelle1").Select
        Range("B4").Select
        ActiveCell.FormulaR1C1 = _
            "Iv_volt = 2;" & Chr(10) & "Card = 8;" & Chr(10) & "Coptr_v = 1;" & Chr(10) & "Exel_1 =0;" & Chr(10) & "Time = 10S;"
        With ActiveCell.Characters(Start:=1, Length:=58).Font
            .Name = "Calibri"
            .FontStyle = "Standard"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ThemeColor = xlThemeColorLight1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontMinor
        End With
        Sheets("Tabelle2").Select
        Range("A5").Select
        ActiveCell.FormulaR1C1 = "Coptr_v"
        Sheets("Tabelle1").Select
        Range("E4").Select
        ActiveCell.FormulaR1C1 = "Hardw.2x" & Chr(10) & "Hardw.3.8" & Chr(10) & "Hardw.1.2" & Chr(10) & "Hardw.2.x"
        With ActiveCell.Characters(Start:=1, Length:=38).Font
            .Name = "Calibri"
            .FontStyle = "Standard"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ThemeColor = xlThemeColorLight1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontMinor
        End With
        Sheets("Tabelle2").Select
        Range("B5").Select
        ActiveCell.FormulaR1C1 = "Hardw.2x" & Chr(10) & "Hardw.3.8" & Chr(10) & "Hardw.1.2" & Chr(10) & "Hardw.2.x"
        With ActiveCell.Characters(Start:=1, Length:=38).Font
            .Name = "Calibri"
            .FontStyle = "Standard"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ThemeColor = xlThemeColorLight1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontMinor
        End With
        Sheets("Tabelle1").Select
        Range("A4").Select
        ActiveCell.FormulaR1C1 = "Sozb176"
        Sheets("Tabelle2").Select
        Range("A6").Select
        ActiveCell.FormulaR1C1 = ""
        Range("C5").Select
        ActiveCell.FormulaR1C1 = "Sozb"
        Range("D4").Select
        Sheets("Tabelle1").Select
        ActiveWindow.SmallScroll Down:=-21
        Application.WindowState = xlMinimized
    End Sub
    Merci beaucoup pour votre aide, j'en suis vraiment à bout .
    Cordialement Stephane

  2. #2
    Expert confirmé
    Homme Profil pro
    aucune
    Inscrit en
    Septembre 2011
    Messages
    8 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : aucune

    Informations forums :
    Inscription : Septembre 2011
    Messages : 8 208
    Par défaut
    Bonjour,

    Il ne fallait pas attendre un mois !
    Par contre, tu devrais détailler précisément ce que tu fais manuellement, parce que je ne vois pas comment tu arrives à ton résultat.

  3. #3
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2012
    Messages
    20
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

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

    Informations forums :
    Inscription : Avril 2012
    Messages : 20
    Par défaut Problème en VBA pour Excel
    Salut Daniel,
    merci deja d'avoir intervenu sur ma question.en effet ce que je veu faire est ceci.
    j'ai un fichier exel dont j'ai joint le fichier a ma question sur le Forum.
    je doit ecrire un Code en VBA qui me permet d'aller dans la colone Parametre de la feuille1 chercher dans chaque cellule de cette colone une variable ,la copier ,aller dans la feuille2, la coller dans la colone "Nom" ensuite revenir dans la feuille1 dans la cellule ou cette variable a eté copier ,copier sur la meme ligne les " N-Projekt" corespondant a la cette variable et la coller a colone Projekt de la feuille2 .et ainsi de suite pour tous les variables de ma feuille1.
    comme je l'ait dit en jetant un petit coup d'œil dans le fichier exel dont j'ai joint a ma question .vous verrez sur la 1er feuille les variables classé en désordre et sur la 2eme feuille vous verrez comment je l'ai classer manuelement (clic).ceque j'aimerais faire c7 d'atomatiser cella grace a une application VBA .
    merci bcp pour votre aide.

    __________________
    Cordialement.

    Stephane

  4. #4
    Expert confirmé
    Homme Profil pro
    aucune
    Inscrit en
    Septembre 2011
    Messages
    8 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : aucune

    Informations forums :
    Inscription : Septembre 2011
    Messages : 8 208
    Par défaut
    Bonjour,

    Mon souci est ce que tu entends par "variable", où je retrouve dans la feuille 2 lv_volt, Card, Ampli... Comment déterminer la variable ? dans la colonne Paramètre" de Feuille 1, je trouve en I3 lv_volt, Card, Ampli; est-ce que ce sont des variables ? Quoi mettre dans la colonne Testnom ?

  5. #5
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2012
    Messages
    20
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

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

    Informations forums :
    Inscription : Avril 2012
    Messages : 20
    Par défaut Problème en VBA pour Excel
    en efait I3 lv_volt, Card, Ampli...ect... coe tu la dit sont en effet des parametres qui sont dans la colone "Parametre" et aussi dans la colone "Exit-to ".
    c'est parametre doivent etre copier un par un et classer dans la colone "Nom" de la feuille2 et ainsi que les nom des projets dans dans quelle ils apparaissent.
    pour la colone "Testnom" c7 claire se sera tjr Sozb car il corespond a l'ID de chaque parametre.
    merci bcp pour votre aide.

    __________________
    Cordialement.

    Stephane

  6. #6
    Expert confirmé
    Homme Profil pro
    aucune
    Inscrit en
    Septembre 2011
    Messages
    8 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : aucune

    Informations forums :
    Inscription : Septembre 2011
    Messages : 8 208
    Par défaut
    Comment séparer les noms de projet qui apparaissent les uns à la suite des autres dans la même cellule ? est-ce qu'il commencent tous par "Hardw" ?

Discussions similaires

  1. [XL-2007] Problème code VBA depuis excel pour générer un document word publiposté
    Par stechet dans le forum Macros et VBA Excel
    Réponses: 1
    Dernier message: 05/02/2015, 10h03
  2. [XL-2003] Problème de VBA sous excel 2003 pour excel 97.
    Par blacksun1 dans le forum Macros et VBA Excel
    Réponses: 5
    Dernier message: 24/06/2010, 11h44
  3. [VBA pour Excel] Différence entre activate et select
    Par loacast dans le forum Macros et VBA Excel
    Réponses: 6
    Dernier message: 23/10/2008, 17h20
  4. [VBA-E] tri sur VBA pour Excel
    Par mariedrouin dans le forum Macros et VBA Excel
    Réponses: 11
    Dernier message: 21/05/2006, 13h32
  5. Réaliser une macro en VBA pour excel afin de créer un graphe
    Par xavier le breuil dans le forum Macros et VBA Excel
    Réponses: 5
    Dernier message: 04/12/2005, 14h41

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