View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
GBExcel via OfficeKB.com GBExcel via OfficeKB.com is offline
external usenet poster
 
Posts: 26
Default Loop Until non-incrementing cell condition met.

Hi Geoff,

I appreciate your reply and yes, it is valuable to help me learn. However, I
don't know what the actual code that I should enter to correct my VBA script
looks like, and being a VBA copy-and-paste newbie, I am not sure how to apply
what you are saying to my script. The weakness is mine.

To clarify.

Geoff_L wrote:
It is not very clear why the value of GJ1 changes when you are recopying the
same thing over and over again.


GJ1 is set up to test if the sum of 1 row [ Range("E5:G5") ] is equal to the
sum of another row [ Range("F2:G2") ]. I have a set of highly complicated
tables that run routines that sort columns into various lengths. The results
of these columns [ Range("E5:G5") ] needs to be checked against a validating
row [ Range("F2:G2") ] to see if the routines must run again. Hence, the
script below, that I need to loop. This must continue until the sum of the 2
rows is equal to each other. If GJ1 =0, it means that the sum of the 2 rows
is not equal to each other and the loop must run again. If it is equal to 1
the script must stop.

1. Do Until GJ1 = 1 - VBA may be seeing GJ1 and a variable that is never
assigned a value and therefore the condition is never met. (This assumes
that you are not using Option Explicit). Try being a bit more specific with
Range("GJ1")


I hear what you are saying here, but I don't know how to apply it.

2. Are you sure that the copying is returning the NUMBER 1 and not the
STRING "1"? It may be that you are looking for one and returning the other.


As above, I hear what you are saying here, but I don't know how to apply it.
I was born somewhat dyslexic, which is why copy-and-paste works best for me.
If I can see the correct code, it helps me to understand the explanation.

I appreciate your help.

GBExcel

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200911/1