none
convert text to "hh:mm" RRS feed

  • Question

  • Hello,

    I have informatin in column B in "HH:mm" format but wenn I send this column to outlook I get text format

    ex. "08:30" I get "0,354166666666667 "

    how can I convert this ?

    Best regards,

    Thursday, March 15, 2018 11:03 AM

Answers

  • thanks Paul I get it with = Format (Cell (2,2),"hh:mm")

    Best regards 

    • Marked as answer by Req_En Tuesday, March 20, 2018 2:51 PM
    Thursday, March 15, 2018 11:05 PM

All replies

  • Please post your VBA code. It isn't clear how you are sending this information and whether it is in text or numeric format.

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Thursday, March 15, 2018 2:08 PM
  • thanks Paul I get it with = Format (Cell (2,2),"hh:mm")

    Best regards 

    • Marked as answer by Req_En Tuesday, March 20, 2018 2:51 PM
    Thursday, March 15, 2018 11:05 PM
  • thanks Paul I get it with = Format (Cell (2,2),"hh:mm")

    Best regards 


    So what is the result? Is it a valid time or no?

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Friday, March 16, 2018 3:41 AM
  • Hello Paul,

    I have checked with

    Dim strText As String
     strText = ...
     If IsNumeric(strText) Then
      MsgBox "Number: " & Val(strText)
     ElseIf IsDate(strText) Then
      MsgBox "Date: " & CDate(strText)
     Else
      MsgBox "String: " & strText
     End If
    

    and I get Number , that mean it is no valid time !

    Best regards,

    Friday, March 16, 2018 8:05 AM
  • Hello Paul,

    I have checked with

    Dim strText As String
     strText = ...
     If IsNumeric(strText) Then
      MsgBox "Number: " & Val(strText)
     ElseIf IsDate(strText) Then
      MsgBox "Date: " & CDate(strText)
     Else
      MsgBox "String: " & strText
     End If

    and I get Number , that mean it is no valid time !

    Best regards,

    OK, a little confused. I see two sets of code, one with Format and the code above. How is the Format function connected to the above code? BTW, the following code works fine for me:

    Dim strText As String
    
    strText = Format(ActiveSheet.Cells(2,2), "hh:mm")
    


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Friday, March 16, 2018 1:08 PM
  • Hello Paul,

    there is no connect between the two codes I just used =Format (Cells(2,2) , "hh:mm") and I get what I want , the second code just to check .

    thank u for your help !

    Best regards,


    • Edited by Req_En Friday, March 16, 2018 1:55 PM
    Friday, March 16, 2018 1:55 PM
  • Hello Paul,

    there is no connect between the two codes I just used =Format (Cells(2,2) , "hh:mm") and I get what I want , the second code just to check .

    thank u for your help !

    Best regards,



    So are you still having a problem with the Outlook integration? That is what I was asking about.

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Friday, March 16, 2018 2:34 PM
  • no thank u very much.

    Regards, 

     
    Friday, March 16, 2018 4:06 PM