1) All the Excel cells referenced in the code below contain numbers
2) The existing code shown will run fine
The actual question is:
How can I change the line below from
A) debt = (Range("G" & column).Value * 1)
to
B) debt = debt + (Range("G" & column).Value * 1)
without causing the code to fail.
How do I add "debt" to itself plus the value in the cell specified. I tried Casting both inputs...making a String variable for the Range input, but nothing worked. This is completely perplexing to me.
Function CALLED(ParamArray list() As Variant) As Integer
Dim code As Variant
Dim column As Integer
Dim debt As Integer
column = 1
debt = 3
For Each code In list
Do While (Range("A" & column).Value <> (code * 1))
column = column + 1
Loop
If (Range("E" & column).Value <> "CALLED") Then
debt = (Range("G" & column).Value * 1)
End If
column = 1
Next code
CALLED = debt
End Function
2007-10-19
08:48:15
·
4 answers
·
asked by
Mendelson
2
in
Computers & Internet
➔ Programming & Design
The first proposed answer did not work.
debtHolder = 0
debtHolder = Range("G" & column)
debt = debt + debtHolder
2007-10-19
10:33:19 ·
update #1
The answer turns out to be making the variables Doubles. But I have no idea why. The values in the cells were all integers and casting them as Integers also worked on a standalone basis. Why??
2007-10-19
12:32:12 ·
update #2