I have a spreadsheet where i need to get total $ value based on terms, i've been strugglin for a few days now trying to write a macro that will do that for me .
Here's how it should work:
For instance account AMT, second row on my spreadsheet has terms 90, i want my macro to grab total value from the leftmost column("L2") and subtract values in each column from "C2" up to "I2". That leaves me with $600 total, but only $100 due.
Same procedure should be repeated for each account.
Cell with value "2%,10,30" is the same as "net 30 days", "2%,15 60" is the same as "net 60 days".
My last idea is to write all values in 2 dimentional array and then use some expression to get desired value, but it's not working out for me. Please help.
VBA that i have:
[vba]
Option Explicit
Sub Test()
Dim x As Range, i As Integer, j As Integer
Dim LastCellb As Integer, LastCellL As Integer
Dim Cols As Variant, Rows As Variant
Dim iData() As Variant
LastCellb = Worksheets("CW").Range("A1").End(xlDown).Row
LastCellL = Worksheets("CW").Range("A1").End(xlToRight).Column
ReDim iData(1 To LastCellb, 1 To LastCellL) As Variant
For i = 1 To LastCellb
For j = 1 To LastCellL
iData(Rows, Cols) = i & "-" & j & ":" & Worksheets("CW").Range(j).Value
Debug.Print iData(Rows, Cols)
Next j
Next i
End Sub
[/vba]
It returns an error though, don't know how to fix it.
file is attached to this message.
Thanks for all your help.