Hi
Firstly
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.
Posting code in [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.
Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
A function should only be used to return a result, not make a change to anything on the sheet. In this case, you are making a change to a cell format, so you should be using a sub.
Try the code below. When it runs, you will be asked to highligh a range. Select the range A1:A10, and continue.
rylo
Bookmarks