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â .