![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Posts: 133
|
I am a total novice on UserForms. I have managed to create a UserForm that works with a TextBox and 2 CommandButtons on it. When I hit the enter key after typing a login pasword into the TextBox it highlights the OK CommandButton. How do I make the enter key do the same as clicking on the OK button ? Question 2 - I want a cell to say "Good Morning" if it is AM, "Good Afternoon" if it is PM and "Good Evening" if it is between 17:00 and 00:00 What formula do I need ?
|
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Wellington
Posts: 104
|
Hi,
Answer 1: You might want to set the OK button's default equals to TRUE. I believe that will work. Answer 2: If Hour(Now()) >= 12 And Hour(Now()) < 17 Then MsgBox ("Good Afternoon") If Hour(Now()) >= 8 And Hour(Now()) < 12 Then MsgBox ("Good Morning") If Hour(Now()) >= 17 And Hour(Now()) < 24 Then MsgBox ("Good Evening") If Hour(Now()) < 8 Then MsgBox ("You shouldn't be working") The codes above is to identify the time of the day, hour especially. HTH |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 133
|
Many thanks - the answer to my first question works well but I have not got the time to try answer 2 at the moment but I'm it will be OK.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|