I created this function and it works to put the value into the cell but it doesnt work to set the .NumberFormat property.
Public Function NewYears(year As Integer)
'Determine the cell that called the function
Dim rng As range
Set rng = ThisWorkbook.Sheets("How-To").range(Application.Caller.Address)
MsgBox rng.Address
fxFormat = "[$" & holidayName & "]"
NewYears = DateSerial(year, 1, 1)
rng.NumberFormat = fxFormat
End Function
Update For more information:
I will be having functions like =NewYears() that returns a date.
I will do this for any number of holidays. I would like to format the field where it still stores the date but the .NumberFormat property has the name of the holiday
So =NewYears() would return "01/01/2014" but in the sheet it would appear as "New Years"