Practice123.xlsm
I have a lot to learn about VBA but was looking for advice to help steer me in the right direction with the current project I am working on.
I have a Intermediate Step Data sheet that has data organized by a Code Number (row) and a Date (column).
I wrote a sub procedure that loops through all the Code Numbers and sums the values associated with alike Code Numbers on the first date.
Option Explicit
Option Base 1
Sub IntermR_Loop()
Dim Counter As Integer
Dim Counter2 As Integer
Dim CostCodeAcct(69, 2) As Variant
Dim AcctCode As Variant
Dim SumofAcct As Double
'Get Cart of Account Codes
For Counter = 1 To 69
CostCodeAcct(Counter, 1) = Application.Worksheets("Cost Codes").Cells(3 + Counter, 7)
Next
For Counter = 1 To 69
AcctCode = CostCodeAcct(Counter, 1)
Counter2 = 1
SumofAcct = 0
Do While Application.Worksheets("Interm").Cells(2 + Counter2, 1) <> ""
If Application.Worksheets("interm").Cells(2 + Counter2, 1) = AcctCode Then
SumofAcct = SumofAcct + Application.Worksheets("interm").Cells(2 + Counter2, 2)
'MsgBox (SumofAcct)
End If
Counter2 = Counter2 + 1
Loop
'MsgBox (AcctCode & SumofAcct)
CostCodeAcct(Counter, 2) = SumofAcct
Next
End Sub
I don't think I can use it for what I am really trying to do though.
What I need to do is take all the alike code number's values for each date and sum them and store the value in a separate sheet showing the Code Number's Sum associated with that date.
I think i need to write a procedure similar to the one shown above only utilized a 3D array. I have been reading posts and reading through John Walkenbach's Excel 2010 Power Programming with VBA, and really just feel frustrated to have zero progress in two weeks....
Any help would be appreciated. Thanks
Sorry if i didnt explain myself well. I will be happy to try and clear up confusion.
Bookmarks