How can i create VBA function like this
Write a user-defined function which returns the appropriate greeting depending on the time. a) Use the VBA-function “ Hour” to obtain the hour from a date/time entered into some particular cell. Call your function “ helloHour” . When the time is 0:00-12:00, your function should return “ Good Morning!” , for 12:00-18:00 it should return “ Good Afternoon!” , for 18:00-22:00 it should return “ Good Evening!” and for 22:00-23:00 it should return “ Good Night !” . b) Write a new function called “ helloWinter” which is more suitable for winter time. When the time is 0:00-12:00 your function should return “ Good Morning!” , for 12:00-16:00 it should return “ Good Afternoon!” , for 16:00-21:00 it should return “ Good Evening!” and for 21:00-23:00 it should return “ Good Night !” . c) Write a function called “ helloBoth” which uses the autumn-winter greeting “ helloWinter” from November to April and otherwise “ helloHour” .