Thread: Iteration Level
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default Iteration Level

not a lot to go on.
These aren't iterations but cell references. If there's an error, what
values are in the variables...they could be out of range

you show hte .Cells method but we don't see the WITH object

you declared PAdown as double, by by default, all your other variables are
VARIANT
this
Dim P, A, Pup, Adown, AP, PupA, PAdown As Double
should be
Dim P As Double, A As Double, Pup As Double, Adown As Double, AP As Double,
PupA As Double, PAdown As Double, k as Long
but no big deal





"Philosophaie" wrote:

This is part odf my code from a Excel VBA program. They are all Julian Dates
around 2451544.5 days. For some reason it does not like PupA = A - Pup. I
think it is the iterations (k+2) then (k+1). Any suggestions?

Dim P, A, Pup, Adown, AP, PupA, PAdown As Double
For k = 1 To n
P = .Cells(k + 2, 5)
A = .Cells(k + 2, 10)
Pup = .Cells(k + 1, 5)
Adown = .Cells(k + 3, 10)
AP = P - A
PAdown = Adown - P
PupA = A - Pup
.Cells(k + 2, 12) = AP
.Cells(k + 2, 13) = PupA
.Cells(k + 2, 14) = PAdown
Next k