Excel macro producing wrong results
Posted on 2003-12-03
I have inherited a macro written by another *gone* programmer which is not working as expected. I am not experienced writing macros, but readingthis code and steppingthrough, seems to be correct and yet, it is not producing the expected results:
For cell = 5 To 27 Step 1
If Range("I" + Format$(cell)) <> "" Then
Range("I" + Format$(cell)).GoalSeek Goal:=0, ChangingCell:=Range("J" + Format$(cell))
When I run this macro, rather than changing the column I cell to 0 and changing the J column to the correct figure, it leaves the I column as is and changes only the J column cell, but it seems to increment the J column every time it is run to a larger, and larger figure...I really don't know why it's is not wotking correctly as the code seems to be pretty straightforward. Can anybody see something wrong with this? Any feedback would be much appreciated.