From: David on
Hello Again,

I did try to Dim these two values and it made the difference. They are the
only 2 that are Dim-ed. I still am not sure why I had to do this, but it did
worked.

Any idea why?

Thanks,
--
David


"ker_01" wrote:

> "AB" wrote:
>
> > From the top of my head the first reason that would come to my mind is
> > that somewhere in your code you're passing your variable (TotalValue)
> > ByRef and not ByVal and that makes the two variables being pretty much
> > one variable (when one changes, so does the other.
>
> That would make sense...
>
From: ker_01 on
> "passing your variable (TotalValue) ByRef and not
> ByVal" this is not happening anywhere.

Just because you didn't explicitly force it doesn't mean that it isn't
happening accidently. Again, since you seem unwilling to post any relevant
code, you probably won't get a concrete answer, at least not without more
back-and-forth.

Is all 11 pages of your code in one sub, or do you have multiple subs that
call each other? Are you passing any parameters (and specifically, either of
these 2 variables) among any of your subs, including other than the sub where
this code is located? If so, consider posting your Sub statement(s) and
associated parameter declaration(s)


"David" wrote:

> Hello Again,
>
> I did try to Dim these two values and it made the difference. They are the
> only 2 that are Dim-ed. I still am not sure why I had to do this, but it did
> worked.
>
> Any idea why?
>
> Thanks,
> --
> David
>
>
> "ker_01" wrote:
>
> > "AB" wrote:
> >
> > > From the top of my head the first reason that would come to my mind is
> > > that somewhere in your code you're passing your variable (TotalValue)
> > > ByRef and not ByVal and that makes the two variables being pretty much
> > > one variable (when one changes, so does the other.
> >
> > That would make sense...
> >
From: David on
Hi,

AB's suggestion for the Dim statement fixed the problem. I still do not know
why with as many variables as there are and none, other than these 2 having
been DIM'ed that it was necessary?

If anyone has some insight, I would like to know.

Thanks,
--
David


"ker_01" wrote:

> > "passing your variable (TotalValue) ByRef and not
> > ByVal" this is not happening anywhere.
>
> Just because you didn't explicitly force it doesn't mean that it isn't
> happening accidently. Again, since you seem unwilling to post any relevant
> code, you probably won't get a concrete answer, at least not without more
> back-and-forth.
>
> Is all 11 pages of your code in one sub, or do you have multiple subs that
> call each other? Are you passing any parameters (and specifically, either of
> these 2 variables) among any of your subs, including other than the sub where
> this code is located? If so, consider posting your Sub statement(s) and
> associated parameter declaration(s)
>
>
> "David" wrote:
>
> > Hello Again,
> >
> > I did try to Dim these two values and it made the difference. They are the
> > only 2 that are Dim-ed. I still am not sure why I had to do this, but it did
> > worked.
> >
> > Any idea why?
> >
> > Thanks,
> > --
> > David
> >
> >
> > "ker_01" wrote:
> >
> > > "AB" wrote:
> > >
> > > > From the top of my head the first reason that would come to my mind is
> > > > that somewhere in your code you're passing your variable (TotalValue)
> > > > ByRef and not ByVal and that makes the two variables being pretty much
> > > > one variable (when one changes, so does the other.
> > >
> > > That would make sense...
> > >
From: sali on
"David" <David(a)discussions.microsoft.com> je napisao u poruci interesnoj
grupi:9A9B6E02-22E1-4578-8D76-5DCF14C3C748(a)microsoft.com...
> Hi,
>
> AB's suggestion for the Dim statement fixed the problem. I still do not
> know
> why with as many variables as there are and none, other than these 2
> having
> been DIM'ed that it was necessary?
>
> If anyone has some insight, I would like to know.

trying to code anything longer than two-liner without 'option explicit'
which forces every variable to be 'dim-as-type' is madness

otherwise, it is unlikely that you have found some excel vba bug, it is most
possible to be some miss-type

reducing and isolating code as long as the effect happens is one of the
methods

if you don't want to post the whole code, maybe to post just 'find' from
cmd, containing lines with those variables?