L
Larry
I want to delete specific range names. The following code
reads the range names from the 1st row
of "Formatted_Input" worksheet into an array. That part
works, but I'm not familiar enough with the "Names"
property to know how to make it delete the ranges whose
names are in the MyArray array.
When I run it I get a "type mismatch" in the "For Each
Name in MyName" statement. I'd appreciate very much a fix
and a brief explanation of what's going on. Many thanks
and Happy Holidays!
Sub DeleteSelectRanges()
Dim MyArray(1 To 256)
Dim i As Integer
Sheets("Formatted_Input").Select
For i = 1 To 200
MyArray(i) = Cells(1, i)
Next i
Names.Add Name:="MyName", RefersTo:=MyArray
For Each Name In MyName
Name.Delete
Next Name
End Sub
reads the range names from the 1st row
of "Formatted_Input" worksheet into an array. That part
works, but I'm not familiar enough with the "Names"
property to know how to make it delete the ranges whose
names are in the MyArray array.
When I run it I get a "type mismatch" in the "For Each
Name in MyName" statement. I'd appreciate very much a fix
and a brief explanation of what's going on. Many thanks
and Happy Holidays!
Sub DeleteSelectRanges()
Dim MyArray(1 To 256)
Dim i As Integer
Sheets("Formatted_Input").Select
For i = 1 To 200
MyArray(i) = Cells(1, i)
Next i
Names.Add Name:="MyName", RefersTo:=MyArray
For Each Name In MyName
Name.Delete
Next Name
End Sub