voraciousv
New Member
- Joined
- Dec 19, 2009
- Messages
- 3
My first macro in VB, I'm trying to:
1)increment a cell (variable called "target") by 0.1
2)recalc anther cell (S50) at each count
3)compare new S50 to its previous value, store if higher to find the max value
target = Range("g2").Value
correl = Range("s50").Value
For Count = 1 To 500
target = target + 0.1
Application.CalculateFullRebuild
If Range("s50").Value > correl Then
corropt = Range("s50").Value
countopt = Count
End If
Next Count
"target" goes through the count fine, the problem is corropt keeps reporting the original S50 value, and countopt keeps saying zero. It's like cell S50 never updates during the loop (cell s50 is indirectly dependent on "target" among other things"). Using excel 2007, thanks for any help!
1)increment a cell (variable called "target") by 0.1
2)recalc anther cell (S50) at each count
3)compare new S50 to its previous value, store if higher to find the max value
target = Range("g2").Value
correl = Range("s50").Value
For Count = 1 To 500
target = target + 0.1
Application.CalculateFullRebuild
If Range("s50").Value > correl Then
corropt = Range("s50").Value
countopt = Count
End If
Next Count
"target" goes through the count fine, the problem is corropt keeps reporting the original S50 value, and countopt keeps saying zero. It's like cell S50 never updates during the loop (cell s50 is indirectly dependent on "target" among other things"). Using excel 2007, thanks for any help!