0

I am using the Excel VBA Do While function to find the right value. Could you please help me to troubleshoot this?

Do While ActiveCell.Value <> "OK"
ActiveCell.Offset(0, -12).Select
ActiveCell.Value = ActiveCell.Value + 0.25
ActiveCell.Offset(0, 12).Select
Loop

ActiveCell.Offset(0, 1).Select

Do While ActiveCell.Value <> "OK"
ActiveCell.Offset(0, -13).Select
ActiveCell.Value = ActiveCell.Value + 0.25
ActiveCell.offselt(0, 13).Select
Loop

This code will be used for calculation on each column. The code should start from C98, which is formulated and currently stated as "Re-Check" status. But based on the C86, this "Re-check" value will turn out to be "OK" or "#N/A"

If C98 turns out to be "ok", I would like to check C99, too. C99 is also possibly "Re-check" status and this value can be changed to "okay" or "#N/A".

I would appreciate any comments/suggestions for this post.

Thank you in advance.

  • 1
    Could you explain what you're expecting the code to do? Use cell references like `A1` and `M1`, something like *I'm increasing in cell A1 by 0.25 so in M1 cell sooner or later the value "OK" will appear due to a formula...*. You can [edit your post](https://stackoverflow.com/review/suggested-edits/31072109) at any time. – VBasic2008 Feb 15 '22 at 06:52
  • @VBasic2008, thank you so much for your feedback . I added my expectation from this code. Please check the edit post and let me know if you have any questions – stevekkong Feb 15 '22 at 13:25
  • Rather than iteratively adding 0.25 to it, why not calculate the number which would result in an output of "OK" and set the number to that value? Also, have a read about [avoiding the use of `Select`](https://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba). – jsheeran Feb 15 '22 at 13:33

0 Answers0