How can this code be modified to increase the number of months instead of days

0 votes

Thank you. I have a form with 15 textboxes from H1 to H15, along with textboxes 3 for the start date of the instalments and 6 for the payment duration for one instalment per month. As the number of days rises, it is necessary to adjust this code so that the number of months increases starting from the date of the payment.

For i = 1 To 15
     If i = 1 Then
         Me("h" & i) = TextBox3.Text
     Else
         Me("h" & i) = Format(CDate(Me.TextBox3.Value) + i - 1, "dd/mm/yyyy")
     End If
Next i

enter image description here

It is required to modify this code so that the number of months increases from the date of the installment, as it increases the number of days. enter image description here

Feb 3, 2023 in Others by Kithuzzz
• 38,010 points
290 views

1 answer to this question.

0 votes

You have to use dateadd.

For i = 1 To 15
    If i = 1 Then
        Me("h" & i) = TextBox3.Text
    Else
        Me("h" & i) = Format(DateAdd("m", i-1, CDate(Me.TextBox3.Value)), "dd/mm/yyyy")
    End If
Next i
answered Feb 3, 2023 by narikkadan
• 63,420 points

Related Questions In Others

0 votes
1 answer

How to format numbers as lakhs and crores in excel/ google spreadsheet when the number could be negative too?

Excel formatting, in my opinion, can only ...READ MORE

answered Oct 31, 2022 in Others by narikkadan
• 63,420 points
12,395 views
0 votes
1 answer

Excel-How can I get the address of a cell instead of a value?

There are various difficulties in this. Which ...READ MORE

answered Dec 29, 2022 in Others by narikkadan
• 63,420 points
279 views
0 votes
1 answer

Datedif issue - convert number of days to "--Years--Months--Days" format

Try, =DATEDIF(0,DATEDIF(B2,C2,"D")*0.75,"Y") & " Years, " & DATEDIF(0,DATEDIF(B2,C2,"D")*0.75,"YM") ...READ MORE

answered Jan 30, 2023 in Others by narikkadan
• 63,420 points
310 views
0 votes
1 answer

How to return the last n number of values corresponding to a specific category?

Try: The formula in F3: =TAKE(SORT(FILTER(A:C,B:B=F1),1),- ...READ MORE

answered Feb 5, 2023 in Others by narikkadan
• 63,420 points
207 views
0 votes
0 answers

Convert Rows to Columns with values in Excel using custom format

1 I having a Excel sheet with 1 ...READ MORE

Feb 17, 2022 in Others by Edureka
• 13,670 points
727 views
0 votes
1 answer

Remove formulas from all worksheets in Excel using VBA

Try this : Option Explicit Sub test1() ...READ MORE

answered Oct 3, 2022 in Others by narikkadan
• 63,420 points
1,464 views
0 votes
1 answer

Calculate monthly average from daily data without PivotTable

Assuming you have the months in column D enter ...READ MORE

answered Oct 3, 2022 in Others by narikkadan
• 63,420 points
1,306 views
0 votes
1 answer

Automate compound annual growth rate (CAGR) calculation

The following PowerPivot DAX formulas worked for ...READ MORE

answered Oct 7, 2022 in Others by narikkadan
• 63,420 points
1,001 views
0 votes
1 answer

How can increase the speed of if statement in VBA Code?

Use a Dictionary Object. Option Explicit Sub PreencherO() ...READ MORE

answered Feb 7, 2023 in Others by narikkadan
• 63,420 points
331 views
0 votes
1 answer

How can I use a command button in excel to set the value of multiple cells in one click?

Try this: Private Scan As Integer Private Sub CommandButton1_Click() ...READ MORE

answered Oct 24, 2022 in Others by narikkadan
• 63,420 points
528 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP