Modifier des en tête de colonnes et supprimer des colonnes
Bonjour,
J'ai un fichier "SuiviCommandes " venant d'un export.
J'aimerais supprimer automatiquement les "0" et dans la colonne "Date d'installation" supprimer les texte, de façon à ne plus avoir que les dates
Merci de votre aide.
J'en suis là
'Mise en forme xls
Range("A1:A50").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1 _
)), TrailingMinusNumbers:=True
'Mise en forme tableau
ActiveCell.FormulaR1C1 = "Nom du poste"
Columns("C:C").Select
Columns("A:A").EntireColumn.AutoFit
Columns("B:B").EntireColumn.AutoFit
Columns("C:C").Select
Selection.Delete Shift:=xlToLeft
Columns("D:D").Select
Selection.Delete Shift:=xlToLeft
ActiveCell.FormulaR1C1 = "Serveur" & Chr(10) & " P à P"
Range("E1").Select
ActiveCell.FormulaR1C1 = "Postes" & Chr(10) & "Clients"
Range("F1").Select
ActiveCell.FormulaR1C1 = "Postes" & Chr(10) & "reconditionnées"
Range("F2").Select
Columns("F:F").EntireColumn.AutoFit
Columns("F:F").ColumnWidth = 11
Columns("F:F").ColumnWidth = 16.29
Range("G1").Select
ActiveCell.FormulaR1C1 = "Date réception devis"
Range("J1").Select
ActiveCell.FormulaR1C1 = "Date prévisionnelle " & Chr(10) & "réception du matériel"
Range("J2").Select
Columns("J:J").ColumnWidth = 18.43
Range("K1").Select
ActiveCell.FormulaR1C1 = "Réception complète"
Range("K1").Select
ActiveCell.FormulaR1C1 = "Réception " & Chr(10) & "complète"
Range("K10").Select
Selection.Copy
Cells.Replace What:="recep_yes", Replacement:="Oui", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
'Alignement des cellules
Range("A1:Q1").Select
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
End Sub
Voilà la macro en direct :
' Supression cols C E J devenues C, D & H
Columns("C:C").Select
Selection.Delete Shift:=xlToLeft
Columns("D:D").Select
Selection.Delete Shift:=xlToLeft
Columns("H:H").Select
Selection.Delete Shift:=xlToLeft
' nom du poste en A1
Range("A1").Select
ActiveCell.FormulaR1C1 = "Nom du poste"
Range("A2").Select
' remplacer 'receipt_yes dans derniere colonne
Dim recep As Variant
'Dim derlig_cascade As Integer
For i = 2 To 50 '50 = fin de tableau bas
If Sheets("SuiviCommandes").Cells(i, 10) = "recep_yes" Then ' 10 = col M devenue J
Sheets("SuiviCommandes").Cells(i, 10) = "Oui"
End If
Next i
End Sub