ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Your Help Needed with the Data List Generation (https://www.excelbanter.com/excel-programming/353778-your-help-needed-data-list-generation.html)

alexandraVBAgirl

Your Help Needed with the Data List Generation
 
Below is the code thats supposed to take the given start and end date and
list all the trading days in between (including the start and end dates).
The macro is taking the trading days data from DVS Reporter through a simple
formula =DVStradingDay(the start date, 1 (means next one, if u put 0, it'll
show the start date again).

Anyhow, my code gave the start date of the list and the 2nd date but nothing
beyond. Can you help me with that please?

Sub help()

Dim i%
Dim curCell As Date
Dim startDate As Date
Dim endDate As Date

startDate = Range("e1").Value
endDate = Range("e2").Value

Range("C1").Select
ActiveCell.FormulaR1C1 = startDate
Sheets("Sheet4").Select

i = 2
Do
curCell = Cells(i, 3).Select
ActiveCell.FormulaR1C1 = "=dvshandelsdatum(R[-1]C,1)"

If curCell endDate Then Cells(i, 3) = ""
i = i + 1
Loop Until Cells(i, 3).Value = ""

End Sub

The worksheet view:

1/1/2005 start date 1/1/2005
1/3/2005 end date 2/2/2006

Thanks so much.


Dave Peterson

Your Help Needed with the Data List Generation
 
You have a reply at your later thread.

alexandraVBAgirl wrote:

Below is the code thats supposed to take the given start and end date and
list all the trading days in between (including the start and end dates).
The macro is taking the trading days data from DVS Reporter through a simple
formula =DVStradingDay(the start date, 1 (means next one, if u put 0, it'll
show the start date again).

Anyhow, my code gave the start date of the list and the 2nd date but nothing
beyond. Can you help me with that please?

Sub help()

Dim i%
Dim curCell As Date
Dim startDate As Date
Dim endDate As Date

startDate = Range("e1").Value
endDate = Range("e2").Value

Range("C1").Select
ActiveCell.FormulaR1C1 = startDate
Sheets("Sheet4").Select

i = 2
Do
curCell = Cells(i, 3).Select
ActiveCell.FormulaR1C1 = "=dvshandelsdatum(R[-1]C,1)"

If curCell endDate Then Cells(i, 3) = ""
i = i + 1
Loop Until Cells(i, 3).Value = ""

End Sub

The worksheet view:

1/1/2005 start date 1/1/2005
1/3/2005 end date 2/2/2006

Thanks so much.


--

Dave Peterson


All times are GMT +1. The time now is 08:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com