提前一个月的细胞范围
我有几个表,列是一个date,我有一个button,提前1个月的所有date。 该button绑定到下面的代码,但它不工作,而是给我一个警报,说400
。 任何帮助表示赞赏
Sub advanceDatebyOneMonth() Dim DateCell As Range Dim DateRange As Range Set DateRange = Range("C11:C26,C32:C40,C46:C54") For Each DateCell In DateRange.Cells Dim firstDate As Date, secondDate As Date firstDate = DateValue(DateCell.Value) secondDate = DateAdd("m", 1, firstDate) Range(DateCell).Value = secondDate Next DateCell End Sub
这一行:
Range(DateCell).Value = secondDate
应该:
DateCell.Value = secondDate
由于DateCell已经是一个范围