代案2
ボタンを設置せずに
「B8セルに「Ctrl]+[;]で日付を入力した」
イベントで実行するマクロです。
Sheet1シートモジュールに
Private Sub Worksheet_Change(ByVal Target As Range)
Dim CNT As Long
If Target.Address <> "$B$8" Then Exit Sub
If Target.Value <> Date Then Exit Sub
CNT = WorksheetFunction.CountIf(Sheets("Sheet2").Columns("A"), Format(Target.Value, "yyyymmdd") & "*")
Application.EnableEvents = False
Target.Value = CStr(Format(Target.Value, "yyyymmdd")) & "-" & Format(CNT + 1, "00")
Application.EnableEvents = True
End Sub
でも、同じになります。