| 
    
     |  | ▼Kein さん: >テストしてみたら、だいぶ間違えてましたね。
 >すいません、こっちでやってみて下さい。
 
 早速ありがとうございます。
 書式が標準/G時は初回入力ではH19.02.20と表示しますが
 一度消して2回目同じように入力を実行すると
 M33.01.20と表示されてしまいます。
 下記をどこかに入れたら修正出来るかと思い
 やってみたのですが???ダメ
 Target.NumberFormatLocal = "G/標準"
 2度目入れ直しの場合の対処出来ますか。
 
 If Day(Date) >= 23 Then
 AdM = 2
 Else
 AdM = 1
 End If
 Application.EnableEvents = False
 
 If Day(DateSerial(Year(Date), Month(Date) + AdM, 0)) < MyD Then
 MsgBox MyD & " 日は存在しません", 48
 Else
 Target.Value = _
 DateSerial(Year(Date), Month(Date) + (AdM - 1), MyD)
 Target.NumberFormat = "ge.mm.dd "’←ここ修正しました。★
 End If
 Application.EnableEvents = True
 End Sub
 
 >
 >Private Sub Worksheet_Change(ByVal Target As Excel.Range)
 >  Dim MyD As Integer, AdM As Integer
 >
 >  If Intersect(Target, Range("B20:B350")) Is _
 >   Nothing Then Exit Sub
 >  With Target
 >   If .Count > 1 Then Exit Sub
 >   If IsEmpty(.Value) Then Exit Sub
 >   If Not IsNumeric(.Value) Then Exit Sub
 >   If .Value < 1 Or .Value > 31 Then Exit Sub
 >   MyD = .Value
 >  End With
 >  If Day(Date) >= 23 Then
 >   AdM = 2
 >  Else
 >   AdM = 1
 >  End If
 >  Application.EnableEvents = False
 >  If Day(DateSerial(Year(Date), Month(Date) + AdM, 0)) < MyD Then
 >   MsgBox MyD & " 日は存在しません", 48
 >  Else
 >   Target.Value = _
 >   DateSerial(Year(Date), Month(Date) + (AdM - 1), MyD)
 >   Target.NumberFormat = "yyyy/m/d"
 >  End If
 >  Application.EnableEvents = True
 >End Sub
 
 |  |