View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sriram Sriram is offline
external usenet poster
 
Posts: 50
Default NEED HELP: For this Code

Dear Friends,

See below my code and it is not coming as desired. Kindly resolve this please.

Private Sub UserForm_Activate()

Dim Wish As String
Dim Cur_Time As Date
Dim Cur_User As String

Cur_Time = Time

'Label1.Caption = Cur_Time

If Cur_Time = "12:00:00AM" And Cur_Time < "12:00:00PM" Then
Wish = "Good Morning"
ElseIf Cur_Time = "12:00:00PM" And Cur_Time < "3:00:00PM" Then
Wish = "Good Afternoon"
ElseIf Cur_Time = "3:00:00PM" And Cur_Time < "12:00:00AM" Then
Wish = "Good Evening"
Else: Wish = "NULL"
End If

Label1.Caption = Cur_Time & " - " & Wish


End Sub

It displays the current time with Wish data as NULL.

Kindly let me know about the mistake I did.

Thanks and Regards,
Sriram Subramaniyan