|
在此基础上,经过测试和完善,能够完全满足提出的要求,且可避免编码重新问题,过程中学到了一些技能,谢谢!
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
a = Cells(Rows.Count, 1).End(xlUp).Offset(1).Address
b = Target.Address
If a <> b Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target.Column = 1 And Target.Row > 1 Then
Target.Value = Date
Target.NumberFormatLocal = "yyyy-mm-dd"
m = Application.CountIf(Range("a2:a10000"), Target.Value)
Target.Offset(, 1) = Format(Year(Date), "00") & _
Format(Month(Date), "00") & _
Format(Day(Date), "00") & Format(m, "00")
End If
End Sub
|
|