使用日期循环命名范围,计算第3列的差异

时间:2022-11-29 20:28:13

I have an Excel sheet that has 2 dynamic named range for user to input starting dates and ending dates.

我有一个Excel工作表,有2个动态命名范围供用户输入开始日期和结束日期。

I would like VBA to check that when user enter starting date and ending date, calculate the difference and have the result shown on 3rd column:

我希望VBA检查当用户输入开始日期和结束日期时,计算差异并将结果显示在第3列:

From        To             No of Days
01.05.15    03.05.15       3
02.05.15    05.05.15       4

If the next starting and ending date row is empty, stop the calculation.

如果下一个开始和结束日期行为空,请停止计算。

1 个解决方案

#1


Why on earth would you want to program this?

为什么你想要编程呢?

In cell C2 enter =B2-A2+1 and format as a general number.

在单元格C2中输入= B2-A2 + 1并格式化为一般数字。

#1


Why on earth would you want to program this?

为什么你想要编程呢?

In cell C2 enter =B2-A2+1 and format as a general number.

在单元格C2中输入= B2-A2 + 1并格式化为一般数字。