请移动下一个日期,如果星期六或星期日落入使用VBA宏,请一直添加到星期一。我宁愿不使用公式。下面的代码使日期在本周的任何时候都增加。非常感谢您的帮助,真的很感激。请让我知道,如果问题不明确,我会尝试重新制定。再次感谢。如果周六或周日落在星期一或星期日
Private Sub Worksheet_Change(ByVal target As Range)
Dim d1 As Date, d2 As Date, d3 As Date
d1 = DateAdd("w", 1, Date)
d2 = DateAdd("w", 7, Date)
d3 = DateAdd("w", 3, Date)
If Not Intersect(target, Range("H3:H150")) Is Nothing Then
If target.Value = 7 Then
target.Offset(0, 1).Value = d2
ElseIf target.Value = 3 Then
target.Offset(0, 1).Value = d3
ElseIf target.Value = 1 Then
target.Offset(0, 1).Value = d1
Else
End If
End If
End Sub
看用'WEEKDAY'功能,让您是否需要添加一个天或2 –