Prev: how do i change tick marks of excel graph from vb.net
Next: Merge Curves in Excel Graph from VB.NET
From: David on 22 Apr 2010 15:21 Hi Group, I have something very strange happening, that I can not explain. I have 2 variables: TotalValue = ActiveCell.Offset(16, 0).Value (Gets set to 102,000, which is a correct value.) TargetTotal = ActiveCell.Offset(64, 0).Value (Gets set to 35000, which is a correct value, BUT TotalValue becomes 35,000) I am not sure what I am missing in this process. Can anyone tell me why this would happened. Thanks, -- David
From: AB on 22 Apr 2010 15:28 I'd think that people here will ask for a bit more of your code to tell where the problem is. 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.
From: EricG on 22 Apr 2010 15:50 It might help if you shows us more of the code surrounding those two statements... Eric "David" wrote: > Hi Group, > > I have something very strange happening, that I can not explain. I have 2 > variables: > > TotalValue = ActiveCell.Offset(16, 0).Value > (Gets set to 102,000, which is a correct value.) > TargetTotal = ActiveCell.Offset(64, 0).Value > (Gets set to 35000, which is a correct value, BUT TotalValue becomes 35,000) > > I am not sure what I am missing in this process. Can anyone tell me why this > would happened. > > Thanks, > -- > David
From: David on 22 Apr 2010 16:13 Hi, There is a lot of code, what difference do you think it would make? These 2 lines follow each other, one right after the other. The code is about 11 pages when copied into Word. These lines appear about 5 pages into the Module. They are one statement right after the other: TotalValue = ActiveCell.Offset(16, 0).Value TargetTotal = ActiveCell.Offset(64, 0).Value The first line ends with a correct value. After the second line runs, it has a correct value in TargetTotal, but TotalValue has changed to the value of TargetTotal. In other words they are now both the same value. As I step through the code, which I have done several times, the opposite also happens: TotalValue = ActiveCell.Offset(16, 0).Value (Captures correct amount, but changes the value of TargetTotal, before the line is even run and puts the value of TotalValue in it) TargetTotal = ActiveCell.Offset(64, 0).Value (Changes the value of BOTH variable to the value of TargetTotal) It is not complicated code, but I sure can not explain it. Thanks, -- David "EricG" wrote: > It might help if you shows us more of the code surrounding those two > statements... > > Eric > > "David" wrote: > > > Hi Group, > > > > I have something very strange happening, that I can not explain. I have 2 > > variables: > > > > TotalValue = ActiveCell.Offset(16, 0).Value > > (Gets set to 102,000, which is a correct value.) > > TargetTotal = ActiveCell.Offset(64, 0).Value > > (Gets set to 35000, which is a correct value, BUT TotalValue becomes 35,000) > > > > I am not sure what I am missing in this process. Can anyone tell me why this > > would happened. > > > > Thanks, > > -- > > David
From: AB on 22 Apr 2010 16:42 How are the TotalValue TargetTotal dimensioned? (i.e. declared with Dim statment)
|
Next
|
Last
Pages: 1 2 3 Prev: how do i change tick marks of excel graph from vb.net Next: Merge Curves in Excel Graph from VB.NET |