Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: 2 Questions...

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Posts
    133
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Wellington
    Posts
    115
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #3
    Board Regular
    Join Date
    Feb 2002
    Posts
    133
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •