I swear I've used this code before but now I am getting Run-time error '424': Object required. I've been looking at my script and searching online and cannot figure out the issue. Please advise if you could.
Sub DelNames()
Dim mgrName As Name
Dim NameHdr() As String
Dim i As Integer
ReDim NameHdr(1 To 3)
NameHdr(1) = "Hdr1"
NameHdr(2) = "Hdr2"
NameHdr(3) = "Hdr3"
For Each mgrName In ActiveWorkbook.Names
For i = 1 To 3
If mgrName.Name = NameHdr(i) Then mgrName.Delete
Next i
Next mgrName
End Sub
Sub DelNames()
Dim mgrName As Name
Dim NameHdr() As String
Dim i As Integer
ReDim NameHdr(1 To 3)
NameHdr(1) = "Hdr1"
NameHdr(2) = "Hdr2"
NameHdr(3) = "Hdr3"
For Each mgrName In ActiveWorkbook.Names
For i = 1 To 3
If mgrName.Name = NameHdr(i) Then mgrName.Delete
Next i
Next mgrName
End Sub