★型(値・数値・文字)変更

【数値を時刻へ変更】

Sub 時間表示変更()

Dim i As Long

Dim a As Date

Dim b As Date

Dim c As Date

Dim d As Date

With Worksheets("承認統合data")

  i = .Cells(Rows.Count, 1).End(xlUp).Row

  

   For i = 2 To i

  

      If .Range("O" & i).Value <> "" Then

   

      a = .Range("O" & i).Value

       b = TimeValue(a)

       .Range("O" & i).Value = Format(b, "hh:mm") '時間に変換

      End If

  

     If .Range("P" & i).Value <> "" Then

   

     c = .Range("P" & i).Value

      d = TimeValue(c)

       .Range("P" & i).Value = Format(d, "hh:mm") '時間に変換

     End If

  Next i

End With

End Sub