I have a excel workbook with many worksheets and a lot of data. One of my VBA functions is the following. It has been working perfectly well.
Function TextResult(Name As String) As String Select Case Name Case Is = "Text1" Name = "Result1" Case Is = "Text2" Name = "Result2" Case Is = "Text3" Name = "Result" End Select End Function
Then I added a Sub that renames my modules:
Sub Whats_In_A_Name() ThisWorkbook.VBProject.VBComponents("Module1").name = "TextResult" ThisWorkbook.VBProject.VBComponents("Module2").name = "Name2" End Sub
This one gave an error but renamed them all, including itself.
But now I get a #NAME? error on all the cells that use these modules that are made like the one above, so all Case functions. And I have no clue how to correct this. Anyone an idea?
Use a different name for your UDF other than the exact name of the module that holds the function.