A
alexandraVBAgirl
Here is the excel ws and the code follows.
1/1/2005 start date 1/1/2005
end date 2/2/2006
This code is supposed to copy the start date, then extract the next trading
days date from DVS referencing the start date through the formula, and do so
until the trading day date = end date. When it's more than that it should
erase the date. So the result should be a list of trading days between and
including the start and end dates.
However, my code only puts a counter from 2 to 20 - how to you make it from
2 to infinity though? Then when i execute this code, it only copies the start
date and doesn't do anything beyond that. Could you guys help me pls?
Thanks.
Sub click()
Dim counter As Integer
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
For counter = 2 To 20
curCell = Worksheets("sheet3").Cells(counter, 3).FormulaR1C1 =
"=dvshandelsdatum(R[-1]C,1)"
If curCell > endDate Then Cells(counter, 3) = ""
Next counter
End Sub
1/1/2005 start date 1/1/2005
end date 2/2/2006
This code is supposed to copy the start date, then extract the next trading
days date from DVS referencing the start date through the formula, and do so
until the trading day date = end date. When it's more than that it should
erase the date. So the result should be a list of trading days between and
including the start and end dates.
However, my code only puts a counter from 2 to 20 - how to you make it from
2 to infinity though? Then when i execute this code, it only copies the start
date and doesn't do anything beyond that. Could you guys help me pls?
Thanks.
Sub click()
Dim counter As Integer
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
For counter = 2 To 20
curCell = Worksheets("sheet3").Cells(counter, 3).FormulaR1C1 =
"=dvshandelsdatum(R[-1]C,1)"
If curCell > endDate Then Cells(counter, 3) = ""
Next counter
End Sub