String array issues. Need help...

J

John Guderian

I have two strings that I am placing into an array, and adding all values
within this array. However I want to add to this a little.

I need for this code to be modified such that when going through the
"billing" array if there is a 0 or empty value, then add the same value from
the "cost" array. Do this until it completes the array. Im not sure how to
modify it to do this. If it cant be modified how can I accomplsih what I
need to do?

Any Idea?

Thanks!

For x = LBound(CostArray) To UBound(CostArray)
If CostArray(x) <> "" Then
FinalCost = FinalCost + CSng(CostArray(x))
End If

Next x

For x = LBound(BillingArray) To UBound(BillingArray)
If BillingArray(x) <> "" Then
FinalBilling = FinalBilling + CSng(BillingArray(x))
End If

Next x
 
B

Bob Phillips

I guess that you mean

For x = LBound(BillingArray) To UBound(BillingArray)
If BillingArray(x) = "" Or BillingArray(x) = 0 Then
FinalBilling = FinalBilling + CSng(CostArray(x))
Else
FinalBilling = FinalBilling + CSng(BillingArray(x))
End If
Next x


--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top