Bonjour,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /??>
Je dois rajouter une colonne dans un programme VBA déjà existant, je voudrais donc rajouter une colonne entre la colonne L et M avec comme titre « Corrected manufacturer part number ».
J’ai essayé d’écrire cela :
Range("M1").Select
ActiveCell.FormulaR1C1 = " Corrected manufacturer part number "
Columns("L:M").Select
Mais ca m’a rajouté une colonne en N , pouvez vous m’aider ?
voici le module VBA du tableau :
Sub VNF_Creation()
'
' Macro VNF_Creation
' Macro enregistrée le 06/04/2007 par idiagana
Application.ScreenUpdating = False
'Clean Document
Sheets("RAW_VNF").Select
Range("A1").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.ClearContents
V = Worksheets("Nest Interface").Range("E13")
'Clean Filter
Sheets("Valeo Extract").Select
Selection.AutoFilter field:=22
'Do Filter
Sheets("Valeo Extract").Select
Selection.AutoFilter field:=22, Criteria1:=V
'Copy extract to VNF sheet
Range("A4").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Sheets("RAW_VNF").Select
Range("A1").Select
ActiveSheet.Paste
'Columns deplacements and deleting
Range("D:D,C:C").Select
Range("C1").Activate
Range("D:D,C:C,N:N,V:V").Select
Range("V1").Activate
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Columns("H:I").Select
Selection.Cut
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Columns("J:K").Select
Selection.Cut
Columns("H:H").Select
Selection.Insert Shift:=xlToRight
Columns("M:M").Select
Selection.Cut
Columns("J:J").Select
Selection.Insert Shift:=xlToRight
Columns("M:M").Select
Selection.Cut
Columns("K:K").Select
Selection.Insert Shift:=xlToRight
Columns("R:R").Select
Selection.Cut
Columns("L:L").Select
Selection.Insert Shift:=xlToRight
'New columns creation
Range("M1").Select
ActiveCell.FormulaR1C1 = "Year N Forecasted Quantity"
Columns("N:N").Select
Selection.Insert Shift:=xlToRight
Range("N1").Select
ActiveCell.FormulaR1C1 = "Year N Realized Quantity"
Columns("O:O").Select
Range("O1").Select
ActiveCell.FormulaR1C1 = "Year N+1 Forecasted Quantity"
Columns("P:P").Select
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Range("P1").Select
ActiveCell.FormulaR1C1 = "Year N Price"
Range("Q1").Select
ActiveCell.FormulaR1C1 = "Year N Currency"
Columns("R:R").Select
Selection.Insert Shift:=xlToRight
Range("R1").Select
ActiveCell.FormulaR1C1 = "Year N Market Share"
Columns("S:S").Select
Selection.Insert Shift:=xlToRight
Range("S1").Select
ActiveCell.FormulaR1C1 = "Target Price"
Columns("T:T").Select
Selection.Insert Shift:=xlToRight
Range("T1").Select
ActiveCell.FormulaR1C1 = "Year N+1 Price"
Columns("U:U").Select
Selection.Insert Shift:=xlToRight
Range("U1").Select
ActiveCell.FormulaR1C1 = "Year N+1 Currency"
Columns("V:V").Select
Selection.Insert Shift:=xlToRight
Range("V1").Select
ActiveCell.FormulaR1C1 = "Year N+1 Market Share"
Rows("1:1").EntireRow.AutoFit
Columns("E:E").Select
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Sheets("Valeo Extract").Select
Columns("C:D").Select
Selection.Copy
Sheets("RAW_VNF").Select
Columns("E:E").Select
ActiveSheet.Paste
Range("E1:F3").Select
Selection.Delete Shift:=xlUp
Application.ScreenUpdating = True
'Save VNF alone in a file
W = Worksheets("Nest Interface").Range("K26")
ActiveSheet.Copy
Application.Dialogs(xlDialogSaveAs).Show (W)
End Sub
Merci !!
Afficher la suite