Forum Discussion

JGB82's avatar
JGB82
Copper Contributor
Jan 11, 2023

UDF not working in Excel 365

I have made a new funcion via VBA and put it in its own module, so not in the workbook or something, I made a new module.

It's a function for giving back the background color code of a selected cell.

 

I have tried it in Excel 365 but it's not working. I can call upon the function but it always gives back #name.

I know the VBA function is correct because I have also tried it in excel 2016 and it's working like a charm there. 

Does anyone know why the function is not working in 365?

I really appreciate all the help I can get!

 

 

BTW this is the function:

Function NumColor(cell As Range)
NumColor = cell.Interior.Color
End Function

20 Replies

  • JGB82's avatar
    JGB82
    Copper Contributor
    Thank you so much all of you! It seems to work now!
    Really really thank you!!!

    BTW if I share this file on Sharepoint do the formulas still work? I saw someone mentioning Macros don't work online?
    • cmaino's avatar
      cmaino
      Copper Contributor

      JGB82 What was your solution that solved this? I am having same issue.

  • JGB82's avatar
    JGB82
    Copper Contributor

    I'm in a desktop version of excel 365 but this is what I get:

     

     

    • Riny_van_Eekelen's avatar
      Riny_van_Eekelen
      Platinum Contributor

      JGB82 Looks like you have disabled macro's in Trust settings (don't know how that's called in NL Excel). when I disable it and reopen the file I get the NAME error.

    • JGB82's avatar
      JGB82
      Copper Contributor

      HansVogelaar No I made a new module. I did it the exact same way in excel 2016 and it's working there. Even if I e-mail the 2016 version to myself and open it in 365 it stops working.

       

       

       

      • JGB82's avatar
        JGB82
        Copper Contributor

        These are my settings for allowing Macro's.

        I have also tried accepting all Macro's but that doesn't change anything.

         

         

Resources