Modification définitive macro complémentaire ?
Bonjour,
J'ai créée il y a quelques temps une macro complémentaire que j'ai associé à un bouton.
Il s'agissait essentiellement de modifier un fichier de données issu de progiciel "maison".
Par "modifier" j'entends suppression de colonne inutile et ajustement de largeur de colonnes et ensuite du format des données.
Aujourd'hui mon hiérarchique souhaite voir apparaitre une colonne de plus !
Mon soucis je ne sais pas où je dois effectuer la modification pour que cela soit définitif dans la macro.
MERCI
Comment veux tu que nous t'aidions si nous n'avons pas un fichier avec ton tableau de base, ta macro et ce que tu veux !
LES GENS VEULENT BIEN AIDER MAIS NE SONT PAS DEVINS !
Dans l'attente,
Girodo,
Re,
Je viens de trouver comment avoir cette colonne en plus : il suffit de l'enlever du :
Range("A,A,............).delete
Maintenant mon soucis est que cette colonne la "Q" s'ajuste en largeur avec le code qui a été créé pour la macro initial et pour la lecture des données de cette colonne il faudrait que la largeur de la colonne "Q" soit de 22.5.
' Largeur_Colonnes Macro
Columns("J:O").Select
Selection.ColumnWidth = 6.71
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
Girodo a écrit :Comment veux tu que nous t'aidions si nous n'avons pas un fichier avec ton tableau de base, ta macro et ce que tu veux !
LES GENS VEULENT BIEN AIDER MAIS NE SONT PAS DEVINS !
Dans l'attente,
Girodo,
Re,
Je comprends
Voici le lien du fichier d'origine qui doit être modifier :
https://www.cjoint.com/c/GJljfhTxztD
Voici le code de la macro qui fonctionne parfaitement :
Sub B_d_C()
Range("F:F,H:H,M:O,R:R,T:T,W:W,Z:AN,AQ:AR,AW:AX,BA:BA").Delete
' Largeur_Colonnes Macro
'
'
Columns("J:O").Select
Selection.ColumnWidth = 6.71
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
' Supprimer_le_Fractionner Macro
'
'
With ActiveWindow
.SplitColumn = 0
.SplitRow = 0
End With
' Impression_têtes_de_Colonnes Macro
'
'
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$4"
.PrintTitleColumns = ""
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = ""
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.748031496062992)
.RightMargin = Application.InchesToPoints(0.748031496062992)
.TopMargin = Application.InchesToPoints(0.984251968503937)
.BottomMargin = Application.InchesToPoints(0.984251968503937)
.HeaderMargin = Application.InchesToPoints(0.511811023622047)
.FooterMargin = Application.InchesToPoints(0.511811023622047)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA3
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = False
.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
' Numéro_pieds_de_Page Macro
'
'
ActiveWindow.View = xlPageLayoutView
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = "&P"
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.748031496062992)
.RightMargin = Application.InchesToPoints(0.748031496062992)
.TopMargin = Application.InchesToPoints(0.984251968503937)
.BottomMargin = Application.InchesToPoints(0.984251968503937)
.HeaderMargin = Application.InchesToPoints(0.511811023622047)
.FooterMargin = Application.InchesToPoints(0.511811023622047)
.Zoom = 71
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = False
.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
Range("D48").Select
ActiveWindow.View = xlNormalView
' Police_11 Macro
'
'
Cells.Select
Range("B48").Activate
With Selection.Font
.Name = "Arial"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
' Hauteur_de_Lignes Macro
'
'
Rows("5:1000").Select
Range("B5").Activate
Selection.RowHeight = 27.75
' Justifier_sur_2_Lignes Macro
'
'
Rows("5:1000").Select
Range("B5").Activate
With Selection
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("B4").Select
Set sh = Sheets("Liste PDI")
lastRow = sh.Cells(Rows.Count, 1).End(xlUp).Row
With sh.Range("A" & lastRow & ":F" & lastRow)
.Merge
End With
End SubEnsuite
les attentes, les modifications :
2 colonnes du fichier d'origine ne doivent plus être supprimés "X" et "Y"
Et la colonne "Y" doit faire 22.5 de largeur pour lire les éventuelles données.
MERCI
Salut,
J'ai modifié le début de ta macro, pour moi ça fonctionne :
Sub B_d_C()
Range("F:F,H:H,M:O,R:R,T:T,W:W,Z:AN,AQ:AR,AW:AX,BA:BA").Delete
' Largeur_Colonnes Macro
'
'
Columns("J:O").ColumnWidth = 6.71
Columns("Y:Y").ColumnWidth = 22.5
' Supprimer_le_Fractionner Macro
Girodo,
Re,
OK, MERCI !
Cela fonctionne chez moi aussi, et c'est ce que je recherchais !
MERCI
@+++