how to get the following output(reference image below) using VBA for getting list of dates from a particular date to particular date?

abhi221996

New Member
Joined
Sep 29, 2021
Messages
35
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
HOW CAN I GET THIS OUTPUT USING VBA?
キャプチャ.PNG
 
Thanks saurabh for your response actually I was stuck in a problem linked below I thought you might be able to help.
simple calendar problem
Hello Abhi,

Below code we can use if would like to use DateAdd method.

VBA Code:
Sub showDates()

Dim fromDate As String, toDate As String
Dim rowno As Integer

fromDate = "12/15/2021"
toDate = "10/1/2022"

Worksheets("Sheet2").Cells(1, 2) = fromDate

For rowno = 1 To DateDiff("d", fromDate, toDate)
    Worksheets("Sheet2").Cells(rowno + 1, 2) = DateAdd("d", 1, Sheets("Sheet2").Cells(rowno, 2))
Next

End Sub
 
Upvote 0

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,216,484
Messages
6,130,936
Members
449,608
Latest member
jacobmudombe

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top