I created this simple UDF to convert a dynamic named range to a fixed one.
The weird thing that's happening is when I run
= D2F("namedrange")
in VBA it works 100% perfectly. But when I run the exact same command from a cell, it dies at names.add line without any errors, it just goes blah.
Any help would be great.
Code:
Public Function D2F(namedrange As String) As String
'Application.Volatile
Dim rng As Range
Set rng = Range(namedrange)
ActiveWorkbook.Names.Add namedrange & "2", rng
D2F = namedrange & "2"
End Function
The weird thing that's happening is when I run
= D2F("namedrange")
in VBA it works 100% perfectly. But when I run the exact same command from a cell, it dies at names.add line without any errors, it just goes blah.
Any help would be great.