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 :

reduire un code


Sujet :

Macros et VBA Excel

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2008
    Messages
    211
    Détails du profil
    Informations personnelles :
    Âge : 56
    Localisation : France

    Informations forums :
    Inscription : Octobre 2008
    Messages : 211
    Points : 64
    Points
    64
    Par défaut reduire un code
    Bonsoir le forum,
    n'étant pas doué en VBA, j'ai fait ce code avec l'enregistreur de macros et je voulais savoir si quelqu'un pouvait m'enlever les lignes inutiles SVP
    merci
    jacfld
    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
    Sub ImprimeMouillerons()
    '
    ' ImprimeMouillerons Macro
    '
     
    '
        Range("B1:F44").Select
        Application.PrintCommunication = False
        With ActiveSheet.PageSetup
            .PrintTitleRows = "$1:$5"
            .PrintTitleColumns = ""
        End With
        Application.PrintCommunication = True
        ActiveSheet.PageSetup.PrintArea = "$B$1:$F$44"
        Application.PrintCommunication = False
        With ActiveSheet.PageSetup
            .LeftHeader = ""
            .CenterHeader = ""
            .RightHeader = ""
            .LeftFooter = ""
            .CenterFooter = ""
            .RightFooter = ""
            .LeftMargin = Application.InchesToPoints(0.236220472440945)
            .RightMargin = Application.InchesToPoints(0.236220472440945)
            .TopMargin = Application.InchesToPoints(0.354330708661417)
            .BottomMargin = Application.InchesToPoints(0.433070866141732)
            .HeaderMargin = Application.InchesToPoints(0.118110236220472)
            .FooterMargin = Application.InchesToPoints(0.196850393700787)
            .PrintHeadings = False
            .PrintGridlines = False
            .PrintComments = xlPrintSheetEnd
            .PrintQuality = -3
            .CenterHorizontally = True
            .CenterVertically = True
            .Orientation = xlPortrait
            .Draft = False
            .PaperSize = xlPaperA4
            .FirstPageNumber = xlAutomatic
            .Order = xlDownThenOver
            .BlackAndWhite = False
            .Zoom = 90
            .PrintErrors = xlPrintErrorsDisplayed
            .OddAndEvenPagesHeaderFooter = False
            .DifferentFirstPageHeaderFooter = False
            .ScaleWithDocHeaderFooter = True
            .AlignMarginsHeaderFooter = True
            .EvenPage.LeftHeader.Text = ""
            .EvenPage.CenterHeader.Text = ""
            .EvenPage.RightHeader.Text = ""
            .EvenPage.LeftFooter.Text = ""
            .EvenPage.CenterFooter.Text = ""
            .EvenPage.RightFooter.Text = ""
            .FirstPage.LeftHeader.Text = ""
            .FirstPage.CenterHeader.Text = ""
            .FirstPage.RightHeader.Text = ""
            .FirstPage.LeftFooter.Text = ""
            .FirstPage.CenterFooter.Text = ""
            .FirstPage.RightFooter.Text = ""
        End With
        Application.PrintCommunication = True
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
            IgnorePrintAreas:=False
        ActiveWindow.ScrollRow = 28
        ActiveWindow.ScrollRow = 27
        ActiveWindow.ScrollRow = 26
        ActiveWindow.ScrollRow = 25
        ActiveWindow.ScrollRow = 24
        ActiveWindow.ScrollRow = 18
        ActiveWindow.ScrollRow = 17
        ActiveWindow.ScrollRow = 15
        ActiveWindow.ScrollRow = 14
        ActiveWindow.ScrollRow = 12
        ActiveWindow.ScrollRow = 10
        ActiveWindow.ScrollRow = 8
        ActiveWindow.ScrollRow = 7
        ActiveWindow.ScrollRow = 5
        ActiveWindow.ScrollRow = 4
        ActiveWindow.ScrollRow = 2
        ActiveWindow.ScrollRow = 1
        Range("B11").Select
    End Sub

  2. #2
    Expert éminent Avatar de jfontaine
    Homme Profil pro
    Contrôleur de Gestion
    Inscrit en
    Juin 2006
    Messages
    4 754
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : France, Sarthe (Pays de la Loire)

    Informations professionnelles :
    Activité : Contrôleur de Gestion

    Informations forums :
    Inscription : Juin 2006
    Messages : 4 754
    Points : 9 396
    Points
    9 396
    Par défaut
    Bonjour,

    Une astuce pour faire le ménage, tu mets la ligne en commentaire et si à l'exécution, tout est ok, c'est qu'elle n'est pas indispensable.
    Jérôme

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2008
    Messages
    211
    Détails du profil
    Informations personnelles :
    Âge : 56
    Localisation : France

    Informations forums :
    Inscription : Octobre 2008
    Messages : 211
    Points : 64
    Points
    64
    Par défaut
    Bonsoir le forum, jFontaine,

    oui tu as raison, je vais essayer comme cela à taton
    merci
    jac

Discussions similaires

  1. Réponses: 1
    Dernier message: 17/01/2014, 23h01
  2. Réponses: 8
    Dernier message: 30/01/2009, 11h17
  3. Reduire code vba
    Par akmer dans le forum Macros et VBA Excel
    Réponses: 3
    Dernier message: 23/04/2008, 14h08
  4. Du code dans la bouton reduire de la form
    Par jacko842 dans le forum VB 6 et antérieur
    Réponses: 2
    Dernier message: 21/01/2008, 07h20
  5. Reduire le code
    Par DevServlet dans le forum Eclipse Java
    Réponses: 8
    Dernier message: 12/07/2007, 18h19

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