Exxcel VBA Tips

日時の中で時間をクリアするマクロです。

Dim i, j As Integer
Dim cell_date_str As String
Dim cell_date, cell_date_only As Date

Sub conv1()
For i = 5 To 3000
If Cells(i, 1) <> "" Or Cells(i, 2) <> "" Or Cells(i, 3) <> "" Or Cells(i, 4) <> "" Then
j = 6
Cells(i, j) <> "" And IsDate(Cells(i, j)) Then
cell_date = CDate(Cells(i, j).Value)
cell_date_str = Format(cell_date, "yyyy/mm/dd")
cell_date_only = CDate(cell_date_str)
Cells(i, j).Value = cell_date_only
End If
If Cells(i, 1) = "" And Cells(i, 2) = "" And Cells(i, 3) = "" And Cells(i, 4) = "" Then
Exit For
End If
Next i
End Sub