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
| Option Explicit
Sub Remp_relatif5()
Dim NomPlage As String, Ex As String
Dim Plage As Range
Dim N As Long
Application.ScreenUpdating = False
SupprNomRef
With Worksheets("Format à désactiver")
N = .Cells(.Rows.Count, 1).End(xlUp).Row
End With
NomPlage = "no_format_travail"
With Worksheets("Travail")
Set Plage = .Range(NomPlage)
Set Plage = Plage.Offset(1).Resize(Plage.Rows.Count - 1) 'Ligne à supprimer au cas ou no_format_travail n'englobe pas la ligne des titres
With Plage
Ex = .Item(1, 1).Address(0, 1)
.Offset(, 1).EntireColumn.Insert
.Offset(, 1).Formula = "=IFERROR(VLOOKUP(" & Ex & ",'Format à désactiver'!$A$1:$B$" & N & ",2,0)," & Ex & ")"
.Value = .Offset(, 1).Value
.Offset(, 1).EntireColumn.Delete
End With
Set Plage = Nothing
End With
End Sub
Private Sub SupprNomRef()
Dim Nms As Name
For Each Nms In Names
If Nms Like "*[#]REF!*" Then Nms.Delete
Next Nms
End Sub |