How can i create VBA function like this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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

30th Sep 2018, 8:08 AM
Tunde Abdulhamid Sanusi
Tunde Abdulhamid Sanusi - avatar
1 Answer
+ 1
VBA isn't really a language that this platform covers anymore or at least at the moment, but if you provide the code you have so far, maybe someone would be willing to look at it. Looking forward.
30th Sep 2018, 10:38 AM
Janning⭐
Janning⭐ - avatar