Home > OS >  Excel VBA - Do While Loop - Date in a cell
Excel VBA - Do While Loop - Date in a cell

Time:04-21

I want to increase the settlement date which is (assigned to cell N13) until the network days (assigned to cell P11) reaches 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 sheet screenshot

CodePudding user response:

to increase Cells(14,11) within the loop, change that line to

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

CodePudding user response:

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

  • Related