Forum Discussion
JGB82
Jan 11, 2023Copper Contributor
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...
HansVogelaar
Jan 11, 2023MVP
Try making the folder containing the workbook a Trusted Location for Excel:
- Select 'Vertrouwde locaties' in the Vertrouwenscentrum dialog.
- If your workbook is stored in a network folder, tick the check box 'Vertrouwde locaties in mijn netwerk toestaan (niet aanbevolen)'.
- Click 'Nieuwe locatie toevoegen...'
- Click Bladeren, select the folder of the workbook, then click OK.
- Quit and restart Excel to be on the safe side.
- Reopen the workbook.
JGB82
Jan 11, 2023Copper Contributor
Ok, I'm gonna try that! Get back to you!
- mtarlerJan 11, 2023Silver Contributoralso note certain folder are 'blocked' from being trusted/allowed like Downloads folder. So make sure you are not using that.
- mtarlerJan 11, 2023Silver Contributor
JGB82 BTW I would suggest a couple tweaks to the UDF
Function NumColor(cell As Range) As Long NumColor = cell.Cells(1, 1).Interior.Color End Functionfirst will define the output format (long) and the second will have the function return the FIRST cell if a range is passed to the function