Skip to content

Instantly share code, notes, and snippets.

@draftcode
Created May 18, 2012 05:53
Show Gist options
  • Select an option

  • Save draftcode/2723447 to your computer and use it in GitHub Desktop.

Select an option

Save draftcode/2723447 to your computer and use it in GitHub Desktop.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Or Target.Column = 5 Then
Dim value As String
value = "" & Target.value
If Len(value) = 6 Then
Target.value = "平成" & Int(Mid(value, 1, 2)) & "年" & _
Int(Mid(value, 3, 2)) & "月" & _
Int(Mid(value, 5, 2)) & "日"
End If
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment