David Beevers
David Beevers

Reputation: 41

Can I call a UDF function by name in Excel?

I'm teaching my students to write UDF's in Excel, and have had them submit an Excel add-in with their functions in a module. They all have standard function names and input variables. I'm trying to find a way to easily write some function calls that should return known solutions, then disable my add-in, and enable each student's add-in to see if their code works as it should.

However, when I disable my add-in, the functions that I create change to reference my add-in file directly, so when I then enable the student's add-in, the functions don't reference the student's add-ins as I want them to.

Does anyone know how I could accomplish this without retyping the test equations for each student's work?

Thanks!

Upvotes: 4

Views: 145

Answers (1)

Jonathan
Jonathan

Reputation: 1015

Instead of using your own add-on, can you add your functions to your personal.xlsb workbook and add each student's to the test workbook in turn? Then you can reference your functions as

=PERSONAL.XLSB!TESTFUNCTION()

and your students' functions as

=TESTWORKBOOK.XLSX!TESTFUNCTION()

The cells referencing your personal workbook will always reference your own formulas. For each student, just copy and paste each module they have created into the test workbook and Excel should then pick them up.

Of course, you will need to copy and paste over the last student's work, so this won't work if you want to compare every student to every other.

Upvotes: 1

Related Questions