I have Excel 2007.
This is what I did -
1. Pressed Alt-F11 to bring up the visual basic editor
2. Clicked to insert a new class module
3. Typed this code:
Public Function colorof(ref As range)
colorof = ref.Interior.Color
End Function
4. Saved file as a macro enabled workbook (.xlsm)
5. Clicked the upper left circle thingy -> clicked Excel Options -> Trust Center -> Trust Center Settings -> Enable all macros.
6. I also checked the box for "Trust access to the VBA project object model", although I'm not sure what that does.
7. Went back to spreadsheet and typed this formula into A2 -
=colorof(A1)
After doing these steps. The value in cell A2 showed #NAME?.
What's wrong?
Bookmarks