S
sylink
Having declared "dt" as date constant, how do i incorporate it into
formula involving cell calculation as shown below.
Dim z As Long
Dim dt As Date
dt = 31 / 12 / 2004
z = 2
Do While Range("A" & z) <> ""
If Range("A" & z).Value <> Range("A" & z + 1).Value And Range("G" &
z).Value > dt Then
Range("R" & z).Select
ActiveCell.FormulaR1C1 = "=((dt-RC[-12])+1)*RC[-7]*(RC[-4]/36600"
ElseIf Range("A" & z).Value <> Range("A" & z + 1).Value And Range("G" &
z).Value <= dt Then
Range("R" & z).Select
ActiveCell.FormulaR1C1 = "=(dt-RC[-12])*RC[-7]*(RC[-4]/36600"
Else
Range("R" & z).Select
ActiveCell.FormulaR1C1 = 0
End If
z = z + 1
Loop
formula involving cell calculation as shown below.
Dim z As Long
Dim dt As Date
dt = 31 / 12 / 2004
z = 2
Do While Range("A" & z) <> ""
If Range("A" & z).Value <> Range("A" & z + 1).Value And Range("G" &
z).Value > dt Then
Range("R" & z).Select
ActiveCell.FormulaR1C1 = "=((dt-RC[-12])+1)*RC[-7]*(RC[-4]/36600"
ElseIf Range("A" & z).Value <> Range("A" & z + 1).Value And Range("G" &
z).Value <= dt Then
Range("R" & z).Select
ActiveCell.FormulaR1C1 = "=(dt-RC[-12])*RC[-7]*(RC[-4]/36600"
Else
Range("R" & z).Select
ActiveCell.FormulaR1C1 = 0
End If
z = z + 1
Loop