|
本帖最后由 YZC51 于 2020-1-18 23:42 编辑
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Or Target.Row < 4 Then Exit Sub
If Target(0, 1) = "" Then Exit Sub
If Target.Column = 4 Then
If Target <> "" And Target.Row > 3 Then
Target(1, -2).Value = Target.Row - 3
If Target.Row = 4 Then
Target(1, -1) = [B2]
Else
Target(1, -1) = Target(0, -1) + 1
End If
If Target(1, 0) = "" Then
If Target.Row = 4 Then
Target(1, 0) = Date - [C2]
Else
Target(1, 0) = Target(0, 0) + 1
End If
'==========================日期列添加数据有效性
For j = -5 To 5
aa = aa & "," & Target(1, 0) + j
Next
With Target(1, 0).Validation
.Delete
.Add Type:=xlValidateList, Formula1:=aa
' .Add TxlValidateList, aa
End With
'====================
End If
End If
End If
End Sub
|
评分
-
2
查看全部评分
-
|