简体   繁体   English

Excel VBA - Do While Loop - 单元格中的日期

[英]Excel VBA - Do While Loop - Date in a cell

I want to increase the settlement date which is (assigned to cell N13) until the.network days (assigned to cell P11) reaches 3.我想增加结算日期(分配给单元格 N13)直到网络日(分配给单元格 P11)达到 3。

Network days counts the number of weekdays between two dates excluding holidays.网络天数计算两个日期之间的工作日数,不包括节假日。 However, I added a range of holidays to it.但是,我为其添加了一系列假期。

Sub Settlement_Date()

Do While Cells(16, 12) < 3
    
    Cells(14,11)
    
Loop

Excel工作表截图

to increase Cells(14,11) within the loop, change that line to要在循环中增加Cells(14,11) ,将该行更改为

Cells(14,11) = Cells(14,11) + 1

Managed to do it myself but got snippets in some of the post I found here我自己设法做到了,但在我在这里找到的一些帖子中得到了片段

Sub Settlement_Date()

Do While ActiveCell.Offset(0, 2).Value < 3 

    ActiveCell.Value = ActiveCell.Value + 1
    
Loop

End Sub

Moving Right One Cell Add one day to date in cells using VBA 向右移动一个单元格使用 VBA 在单元格中添加一天

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM