我要解决的问题:我想查看一个自动填充截止日期的列。我的组织希望提前两个工作日 (M-Th) 强制执行内部到期日期。为了根据实际到期日所在的一周中的哪一天自动填充内部到期日,我写了这个子:
Sub In_House()
Dim In_HouseDue
Dim CurrentCell
CurrentCell = Range("D3").Value
Select Case CurrentCell
Case Weekday(CurrentCell) = 1
In_HouseDue.Value = DateAdd("d", 5, CurrentCell)
ActiveCell.Offset(1, 0).Select
Case Weekday(CurrentCell) = 2
In_HouseDue.Value = DateAdd("d", 5, CurrentCell)
ActiveCell.Offset(1, 0).Select
Case Weekday(CurrentCell) = 3
In_HouseDue.Value = DateAdd("d", 2, CurrentCell)
ActiveCell.Offset(1, 0).Select
Case Weekday(CurrentCell) = 4
In_HouseDue.Value = DateAdd("d", 2, CurrentCell)
ActiveCell.Offset(1, 0).Select
Case Weekday(CurrentCell) = 5
In_HouseDue.Value = DateAdd("d", 2, CurrentCell)
ActiveCell.Offset(1, 0).Select
Case Weekday(CurrentCell) = 6
In_HouseDue.Value = DateAdd("d", 3, CurrentCell)
ActiveCell.Offset(1, 0).Select
Case Weekday(CurrentCell) = 7
In_HouseDue.Value = DateAdd("d", 4, CurrentCell)
ActiveCell.Offset(1, 0).Select
In_HouseDue = Range("E3").Value
End Select
End Sub
它运行没有任何错误,但实际上并没有填充以单元格“E3”开头的内部到期日期列
任何帮助都会很棒!