VBA to pull reference a different worksheet

cgsierra

Board Regular
Joined
Mar 21, 2011
Messages
132
Hello,
I have a workbook that has a VBA code. I use this workbook for company ABC and my coworkers use it for many other companies. There are like 5 iterations of this workbook. Each workbook has about 10 worksheets, including a "Raw Data" tab. The VBA code in each workbook essentially extracts data from the "Raw Data" tab and populates the info on the other 9 worksheets. I want to centralize the "Raw Data" worksheet in a separate workbook as the "Raw Data" tabs for all companies are exactly the same and it contains a lot of rows making each file very heavy.
Is there a way to run the VBA in each company file so that it accesses/references the information located in the separate centralized file without having to open the centralized file?
The path to the centralized file is the following:
S:\Shared Folders\FP&A 7yr\07-CCS\Forecasts\2019\Management Month End Check Tools\Raw Data.xlsb, the tab name is "Raw Data"
The current VBA code is as follows:
Code:
Option Explicit


Global Const Troubleshooting_Mode = False    'toggles troubleshooting options
Sub AddEmUp()
Dim wksReport As Worksheet, wksData As Worksheet
Dim MyTable As Range, myDates As Range
Dim MyParmCols As Variant, MyAccts As Range, DateCols As Variant
Dim MyData As Variant, MyParmData As Variant, mdate As Variant, mycell As Variant
Dim arrAccts
Dim MyFilter As Object, WildCardFilter As Object
Dim i As Long, j As Long, k As Long, acc As Long, c As Long
Dim d1 As String, errMessage As String, d2 As String
Dim cAppState As clsAppState
Dim acct As Long
Dim ResultsArray
Dim counter As Integer, FirstColumn As Integer
Dim bCurrentArray As Boolean, bResetArray As Boolean
Dim CodeCollection As Collection
Dim SplitCodes


If Not Troubleshooting_Mode Then
    On Error GoTo ErrHandler    'general error handling
    'turns off functionality that slows programs down
    Set cAppState = New clsAppState
    cAppState.SetState None
End If


'setting some sheet objects
Set wksData = Worksheets("Raw Data")
Set wksReport = ActiveSheet


' Define parameters
Set MyTable = wksData.Range("A1:M1")             ' Define top row of the data table, the macro figures -
'  out the bottom row based on the last non-empty cell in A


' Read the "Raw Data"
MyData = MyTable.Resize(MyTable.Resize(1, 1).Offset(Rows.Count - 1).End(xlUp).Row)


With wksReport
    'if you use 'Set' - then you're just assigning the object to a range
    'if you remove the 'Set' then you are placing the range into an array and into memory


    Set MyAccts = .Range("G14:J343")             ' This should be the column where the accounts are -
    '  set the rows to first row with an account to the -
    '  last row with an account, empty cells will be ignored
    ' expand to include the columns with the additional information to include (SL and/or Code)
    arrAccts = MyAccts    'put range into memory


    Set myDates = .Range("M12:p12, AF12:Aq12, AY12:BJ12, BR12:CC12, ck12:cv12, dd12:do12")    ' Set this to the cells with the dates, if there are gaps, -
    '  define the ranges as shown.  The "ACTUALS" or "BUDGET" -
    '  row is assumed to be above this row


    ' The parameters - can be an actual parameter or a "*" to mean -
    '  match anything - no other wildcards are supported
    ' Read the parms
    MyParmData = .Range("L2:O7")
End With


MyParmCols = Array(1, 2, 3, 4, 5, 6)                     ' The columns that the parameters relate to - in this example, -
'  the parameters on row 2 match column 1 (A) on the "Raw Data" -
'  sheet, row 3 matches column 2, row 4 matches column 3, row 5 -
'  matches nothing (0), etc.


'Put Date columns into array
'doing this to speed things up
ReDim DateCols(1 To myDates.Count)    'creating an array to fit the column numbers
For Each mycell In myDates
    i = i + 1
    DateCols(i) = mycell.Column
Next mycell


' Create a dictionary to put the totals in
Set MyFilter = CreateObject("Scripting.Dictionary")
Set WildCardFilter = CreateObject("Scripting.Dictionary")


' Read through the raw data, selecting the rows that match the parameters
For i = 1 To UBound(MyData)
    For j = 1 To UBound(MyParmData)
        If MyParmCols(j - 1) = 0 Then
            GoTo NextJ
        End If
        For k = 1 To 4
            If MyData(i, MyParmCols(j - 1)) = MyParmData(j, k) Or MyParmData(j, k) = "*" Then
                GoTo NextJ
            End If
        Next k
        GoTo NextI:
NextJ:
    Next j
    ' Found a match on all parameters, create a key with the acct, month, year, and type,then add up the total
    d1 = CLng(MyData(i, 7)) & "|" & MyData(i, 9) & "|" & MyData(i, 10) & "|" & LCase(MyData(i, 12)) & "|" & CLng(MyData(i, 13))
    MyFilter(d1) = MyFilter(d1) + MyData(i, 11)


    d2 = CLng(MyData(i, 7)) & "|" & MyData(i, 9) & "|" & MyData(i, 10) & "|" & LCase(MyData(i, 12))
    WildCardFilter(d2) = WildCardFilter(d2) + MyData(i, 11)


NextI:
Next i


counter = 1


' All totals found, now read through all the accounts/dates on the output sheet and place the totals
' code loops through the columns for each row
With wksReport
    For acct = 1 To UBound(arrAccts)    'loop through each row in the array
        '  If acct = 132 Then Stop 'test line
        If Len(Trim(arrAccts(acct, 1))) > 0 Then


            acc = Trim(arrAccts(acct, 1))    'place the Acct value in the array into a variable
            If acc <> 0 Then                ' ignore empty cells in the Accounts column
                For mdate = 1 To UBound(DateCols)    'loop through the Date columns
                    Set CodeCollection = New Collection  'reset the collection
                    'if there's a comma in column J (MyAccts(acct,4), then split it into an array and loop through the values
                    'if there's an * in the column, won't do split
                    'either way, results are added to the collection
                    'If acct = 132 And mdate = 37 Then Stop 'test line
                    ' Make a key with the account, month, year, and type, and read the total from the dictionary
                    ' we're looking up the information on the sheet using variables in memory
                    If InStr(MyAccts(acct, 4), "*") = 0 Then    'looks in cell for *, if found, skips
                        SplitCodes = Split(MyAccts(acct, 4), ",")
                        For c = LBound(SplitCodes) To UBound(SplitCodes)
                            d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                    "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value)) & "|" & Trim(SplitCodes(c))   'the value above the date and the Code
                            CodeCollection.Add d1    'add the key to the collection
                        Next c
                    Else
                        d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value))    'the value above the date
                        CodeCollection.Add d1
                    End If


                    'because the data is not consecutive by row or columns,
                    'I have to write short arrays to the sheet.


                    'logic to figure out if i need to create a fresh array or continue to populate the current
                    If mdate = 1 Then
                        bCurrentArray = True
                    ElseIf DateCols(mdate) = DateCols(mdate - 1) + 1 Then
                        bCurrentArray = True
                    Else
                        bCurrentArray = False
                    End If


                    'handles the array
                    If bCurrentArray Then
                        If Not IsArray(ResultsArray) Or bResetArray Then
                            'start a new array
                            FirstColumn = DateCols(mdate)
                            ReDim ResultsArray(1 To 1)
                            bResetArray = False
                        Else    'continue to use the current array
                            ReDim Preserve ResultsArray(1 To UBound(ResultsArray) + 1)
                        End If
                    Else
                        'dump the current array for the row & columns
                        'it's dumping the array for the previous set of dates
                        .Cells(MyAccts(1, 1).Offset(acct - 1).Row, FirstColumn).Resize(, UBound(ResultsArray)).Value = ResultsArray
                        'and start a new array
                        FirstColumn = DateCols(mdate)
                        ReDim ResultsArray(1 To 1)
                        bResetArray = False


                    End If


                    'loop through the collection of lookups and sum the returned values
                    'since * codes only allow for a single return values, there is no summing
                    For c = 1 To CodeCollection.Count
                        If MyAccts(acct, 4) <> "*" Then
                            If IsEmpty(MyFilter(CodeCollection(c))) Then
                                ResultsArray(UBound(ResultsArray)) = ResultsArray(UBound(ResultsArray)) + 0
                            Else
                                ResultsArray(UBound(ResultsArray)) = ResultsArray(UBound(ResultsArray)) + MyFilter(CodeCollection(c))


                            End If
                        Else    'is a * code, so no summing
                            If IsEmpty(WildCardFilter(CodeCollection(c))) Then
                                ResultsArray(UBound(ResultsArray)) = 0
                            Else
                                ResultsArray(UBound(ResultsArray)) = WildCardFilter(CodeCollection(c))
                            End If


                        End If
                    Next c


                Next mdate
            End If
            bResetArray = True
            'dump the last set of dates for the row
            .Cells(MyAccts(1, 1).Offset(acct - 1).Row, FirstColumn).Resize(, UBound(ResultsArray)).Value = ResultsArray
        End If
    Next acct
End With


ErrHandler:
If Err.Number <> 0 Then
    errMessage = errMessage & Chr(10) & "Module3.AddEmUp = " & Err.Number & ": " & Err.Description
End If
If Len(errMessage) > 0 Then
    MsgBox errMessage, vbInformation, "Unable to continue"
End If
Set cAppState = Nothing    'reset all the settings


Call Module4.AddEmUp


End Sub
 
Last edited:

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
9,983
Place a lowercase "x" in cell L1 of each sheet that you want to update. Leave L1 blank if you don't want that sheet updated. There was no way that I could test this revised macro, but give it a try. The macro would have to be placed in each company file.
Option Explicit
Code:
Option Explicit
Sub AddEmUp()
    Dim wksReport As Worksheet, wksData As Worksheet, desWB As Workbook
    Set desWB = ThisWorkbook
    Dim MyTable As Range, myDates As Range
    Dim MyParmCols As Variant, MyAccts As Range, DateCols As Variant
    Dim MyData As Variant, MyParmData As Variant, mdate As Variant, mycell As Variant
    Dim arrAccts
    Dim MyFilter As Object, WildCardFilter As Object
    Dim i As Long, j As Long, k As Long, acc As Long, c As Long
    Dim d1 As String, errMessage As String, d2 As String
    Dim cAppState As clsAppState
    Dim acct As Long
    Dim ResultsArray
    Dim counter As Integer, FirstColumn As Integer
    Dim bCurrentArray As Boolean, bResetArray As Boolean
    Dim CodeCollection As Collection
    Dim SplitCodes
    Dim RawDataWB As Workbook
    Application.ScreenUpdating = False
    If Not Troubleshooting_Mode Then
        On Error GoTo ErrHandler    'general error handling
        'turns off functionality that slows programs down
        Set cAppState = New clsAppState
        cAppState.SetState None
    End If
    'setting some sheet objects
    Set RawDataWB = Workbooks.Open("S:\Shared Folders\FP&A 7yr\07-CCS\Forecasts\2019\Management Month End Check Tool\Raw Data.xlsb")
    Set wksData = Worksheets("Raw Data")
    For Each wksReport In desWB.Sheets
        If wksReport.Range("L1") = "x" Then
            ' Define parameters
            Set MyTable = wksData.Range("A1:M1")             ' Define top row of the data table, the macro figures -
            '  out the bottom row based on the last non-empty cell in A
            ' Read the "Raw Data"
            MyData = MyTable.Resize(MyTable.Resize(1, 1).Offset(Rows.Count - 1).End(xlUp).Row)
            With wksReport
                'if you use 'Set' - then you're just assigning the object to a range
                'if you remove the 'Set' then you are placing the range into an array and into memory
                Set MyAccts = .Range("G344:G570")             ' This should be the column where the accounts are -
                '  set the rows to first row with an account to the -
                '  last row with an account, empty cells will be ignored
                ' expand to include the columns with the additional information to include (SL and/or Code)
                arrAccts = MyAccts    'put range into memory
                Set myDates = .Range("M12:p12, AF12:Aq12, AY12:BJ12, BR12:CC12, ck12:cv12, dd12:do12")    ' Set this to the cells with the dates, if there are gaps, -
                '  define the ranges as shown.  The "ACTUALS" or "BUDGET" -
                '  row is assumed to be above this row
            
            
                ' The parameters - can be an actual parameter or a "*" to mean -
                '  match anything - no other wildcards are supported
                ' Read the parms
                MyParmData = .Range("L2:O7")
            End With
            MyParmCols = Array(1, 2, 3, 4, 5, 6)                     ' The columns that the parameters relate to - in this example, -
            '  the parameters on row 2 match column 1 (A) on the "Raw Data" -
            '  sheet, row 3 matches column 2, row 4 matches column 3, row 5 -
            '  matches nothing (0), etc.
            'Put Date columns into array
            'doing this to speed things up
            ReDim DateCols(1 To myDates.Count)    'creating an array to fit the column numbers
            For Each mycell In myDates
                i = i + 1
                DateCols(i) = mycell.Column
            Next mycell
            ' Create a dictionary to put the totals in
            Set MyFilter = CreateObject("Scripting.Dictionary")
            Set WildCardFilter = CreateObject("Scripting.Dictionary")
            ' Read through the raw data, selecting the rows that match the parameters
            For i = 1 To UBound(MyData)
                For j = 1 To UBound(MyParmData)
                    If MyParmCols(j - 1) = 0 Then
                        GoTo NextJ
                    End If
                    For k = 1 To 4
                        If j = 3 Then
                            MyParmData(3, k) = "145"
                        End If
                        If MyData(i, MyParmCols(j - 1)) = MyParmData(j, k) Or MyParmData(j, k) = "*" Then
                            GoTo NextJ
                        End If
                    Next k
                    GoTo NextI:
NextJ:
                Next j
                ' Found a match on all parameters, create a key with the acct, month, year, and type,then add up the total
                d1 = CLng(MyData(i, 7)) & "|" & MyData(i, 9) & "|" & MyData(i, 10) & "|" & LCase(MyData(i, 12)) & "|" & CLng(MyData(i, 13))
                MyFilter(d1) = MyFilter(d1) + MyData(i, 11)
                'create a key with acct, month, year - this is for records that have an * for the Code (hierarchy)
                d2 = CLng(MyData(i, 7)) & "|" & MyData(i, 9) & "|" & MyData(i, 10) & "|" & LCase(MyData(i, 12))
                WildCardFilter(d2) = WildCardFilter(d2) + MyData(i, 11)
NextI:
            Next i
            counter = 1
            ' All totals found, now read through all the accounts/dates on the output sheet and place the totals
            ' code loops through the columns for each row
            With wksReport
                For acct = 1 To UBound(arrAccts)    'loop through each row in the array
                    ' If acct = 132 Then Stop
                    If Len(Trim(arrAccts(acct, 1))) > 0 Then
                        acc = Trim(arrAccts(acct, 1))    'place the Acct value in the array into a variable
                        If acc <> 0 Then                ' ignore empty cells in the Accounts column
                            For mdate = 1 To UBound(DateCols)    'loop through the Date columns
                                Set CodeCollection = New Collection  'reset the collection
                                ' Make a key with the account, month, year, and type, and read the total from the dictionary
                                ' we're looking up the information on the sheet using variables in memory
                                '                    d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                                     '                            "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value)) & "|" & MyAccts(acct, 3) & "|" & MyAccts(acct, 4)   'the value above the date, the SL (3) and the Code (4)
                                If InStr(MyAccts(acct, 4), "*") = 0 Then    'looks in cell for *, if found, skips
                                    SplitCodes = Split(MyAccts(acct, 4), ",")
                                    For c = LBound(SplitCodes) To UBound(SplitCodes)
                                        d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                                "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value)) & "|" & Trim(SplitCodes(c))   'the value above the date and the Code
                                        CodeCollection.Add d1    'add the key to the collection
                                    Next c
                                Else
                                    d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                            "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value))    'the value above the date
                                    CodeCollection.Add d1
                                End If
                                'because the data is not consecutive by row or columns,
                                'I have to write short arrays to the sheet.
                                'logic to figure out if i need to create a fresh array or continue to populate the current
                                If mdate = 1 Then
                                    bCurrentArray = True
                                ElseIf DateCols(mdate) = DateCols(mdate - 1) + 1 Then
                                    bCurrentArray = True
                                Else
                                    bCurrentArray = False
                                End If
                                'handles the array
                                If bCurrentArray Then
                                    If Not IsArray(ResultsArray) Or bResetArray Then
                                        'start a new array
                                        FirstColumn = DateCols(mdate)
                                        ReDim ResultsArray(1 To 1)
                                        bResetArray = False
                                    Else    'continue to use the current array
                                        ReDim Preserve ResultsArray(1 To UBound(ResultsArray) + 1)
                                    End If
                                Else
                                    'dump the current array for the row & columns
                                    'it's dumping the array for the previous set of dates
                                    .Cells(MyAccts(1, 1).Offset(acct - 1).Row, FirstColumn).Resize(, UBound(ResultsArray)).Value = ResultsArray
                                    'and start a new array
                                    FirstColumn = DateCols(mdate)
                                    ReDim ResultsArray(1 To 1)
                                    bResetArray = False
                                End If
                                'loop through the collection of lookups and sum the returned values
                                'since * codes only allow for a single return values, there is no summing
                                For c = 1 To CodeCollection.Count
                                    If MyAccts(acct, 4) <> "*" Then
                                        If IsEmpty(MyFilter(CodeCollection(c))) Then
                                            ResultsArray(UBound(ResultsArray)) = ResultsArray(UBound(ResultsArray)) + 0
                                        Else
                                            ResultsArray(UBound(ResultsArray)) = ResultsArray(UBound(ResultsArray)) + MyFilter(CodeCollection(c))
                                        End If
                                    Else    'is a * code, so no summing
                                        If IsEmpty(WildCardFilter(CodeCollection(c))) Then
                                            ResultsArray(UBound(ResultsArray)) = 0
                                        Else
                                            ResultsArray(UBound(ResultsArray)) = WildCardFilter(CodeCollection(c))
                                        End If
                                    End If
                                Next c
                            Next mdate
                        End If
                        bResetArray = True
                        'dump the last set of dates for the row
                        .Cells(MyAccts(1, 1).Offset(acct - 1).Row, FirstColumn).Resize(, UBound(ResultsArray)).Value = ResultsArray
                    End If
                Next acct
            End With
        End If
    Next wksReport
    RawDataWB.Close False
ErrHandler:
    If Err.Number <> 0 Then
        errMessage = errMessage & Chr(10) & "Module3.AddEmUp = " & Err.Number & ": " & Err.Description
    End If
    If Len(errMessage) > 0 Then
        MsgBox errMessage, vbInformation, "Unable to continue"
    End If
    Set cAppState = Nothing    'reset all the settings
    Application.ScreenUpdating = True
End Sub
 
Last edited:

Some videos you may like

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

cgsierra

Board Regular
Joined
Mar 21, 2011
Messages
132
Place a lowercase "x" in cell L1 of each sheet that you want to update. Leave L1 blank if you don't want that sheet updated. There was no way that I could test this revised macro, but give it a try. The macro would have to be placed in each company file.
Option Explicit
Code:
Option Explicit
Sub AddEmUp()
    Dim wksReport As Worksheet, wksData As Worksheet, desWB As Workbook
    Set desWB = ThisWorkbook
    Dim MyTable As Range, myDates As Range
    Dim MyParmCols As Variant, MyAccts As Range, DateCols As Variant
    Dim MyData As Variant, MyParmData As Variant, mdate As Variant, mycell As Variant
    Dim arrAccts
    Dim MyFilter As Object, WildCardFilter As Object
    Dim i As Long, j As Long, k As Long, acc As Long, c As Long
    Dim d1 As String, errMessage As String, d2 As String
    Dim cAppState As clsAppState
    Dim acct As Long
    Dim ResultsArray
    Dim counter As Integer, FirstColumn As Integer
    Dim bCurrentArray As Boolean, bResetArray As Boolean
    Dim CodeCollection As Collection
    Dim SplitCodes
    Dim RawDataWB As Workbook
    Application.ScreenUpdating = False
    If Not Troubleshooting_Mode Then
        On Error GoTo ErrHandler    'general error handling
        'turns off functionality that slows programs down
        Set cAppState = New clsAppState
        cAppState.SetState None
    End If
    'setting some sheet objects
    Set RawDataWB = Workbooks.Open("S:\Shared Folders\FP&A 7yr\07-CCS\Forecasts\2019\Management Month End Check Tool\Raw Data.xlsb")
    Set wksData = Worksheets("Raw Data")
    For Each wksReport In desWB.Sheets
        If wksReport.Range("L1") = "x" Then
            ' Define parameters
            Set MyTable = wksData.Range("A1:M1")             ' Define top row of the data table, the macro figures -
            '  out the bottom row based on the last non-empty cell in A
            ' Read the "Raw Data"
            MyData = MyTable.Resize(MyTable.Resize(1, 1).Offset(Rows.Count - 1).End(xlUp).Row)
            With wksReport
                'if you use 'Set' - then you're just assigning the object to a range
                'if you remove the 'Set' then you are placing the range into an array and into memory
                Set MyAccts = .Range("G344:G570")             ' This should be the column where the accounts are -
                '  set the rows to first row with an account to the -
                '  last row with an account, empty cells will be ignored
                ' expand to include the columns with the additional information to include (SL and/or Code)
                arrAccts = MyAccts    'put range into memory
                Set myDates = .Range("M12:p12, AF12:Aq12, AY12:BJ12, BR12:CC12, ck12:cv12, dd12:do12")    ' Set this to the cells with the dates, if there are gaps, -
                '  define the ranges as shown.  The "ACTUALS" or "BUDGET" -
                '  row is assumed to be above this row
            
            
                ' The parameters - can be an actual parameter or a "*" to mean -
                '  match anything - no other wildcards are supported
                ' Read the parms
                MyParmData = .Range("L2:O7")
            End With
            MyParmCols = Array(1, 2, 3, 4, 5, 6)                     ' The columns that the parameters relate to - in this example, -
            '  the parameters on row 2 match column 1 (A) on the "Raw Data" -
            '  sheet, row 3 matches column 2, row 4 matches column 3, row 5 -
            '  matches nothing (0), etc.
            'Put Date columns into array
            'doing this to speed things up
            ReDim DateCols(1 To myDates.Count)    'creating an array to fit the column numbers
            For Each mycell In myDates
                i = i + 1
                DateCols(i) = mycell.Column
            Next mycell
            ' Create a dictionary to put the totals in
            Set MyFilter = CreateObject("Scripting.Dictionary")
            Set WildCardFilter = CreateObject("Scripting.Dictionary")
            ' Read through the raw data, selecting the rows that match the parameters
            For i = 1 To UBound(MyData)
                For j = 1 To UBound(MyParmData)
                    If MyParmCols(j - 1) = 0 Then
                        GoTo NextJ
                    End If
                    For k = 1 To 4
                        If j = 3 Then
                            MyParmData(3, k) = "145"
                        End If
                        If MyData(i, MyParmCols(j - 1)) = MyParmData(j, k) Or MyParmData(j, k) = "*" Then
                            GoTo NextJ
                        End If
                    Next k
                    GoTo NextI:
NextJ:
                Next j
                ' Found a match on all parameters, create a key with the acct, month, year, and type,then add up the total
                d1 = CLng(MyData(i, 7)) & "|" & MyData(i, 9) & "|" & MyData(i, 10) & "|" & LCase(MyData(i, 12)) & "|" & CLng(MyData(i, 13))
                MyFilter(d1) = MyFilter(d1) + MyData(i, 11)
                'create a key with acct, month, year - this is for records that have an * for the Code (hierarchy)
                d2 = CLng(MyData(i, 7)) & "|" & MyData(i, 9) & "|" & MyData(i, 10) & "|" & LCase(MyData(i, 12))
                WildCardFilter(d2) = WildCardFilter(d2) + MyData(i, 11)
NextI:
            Next i
            counter = 1
            ' All totals found, now read through all the accounts/dates on the output sheet and place the totals
            ' code loops through the columns for each row
            With wksReport
                For acct = 1 To UBound(arrAccts)    'loop through each row in the array
                    ' If acct = 132 Then Stop
                    If Len(Trim(arrAccts(acct, 1))) > 0 Then
                        acc = Trim(arrAccts(acct, 1))    'place the Acct value in the array into a variable
                        If acc <> 0 Then                ' ignore empty cells in the Accounts column
                            For mdate = 1 To UBound(DateCols)    'loop through the Date columns
                                Set CodeCollection = New Collection  'reset the collection
                                ' Make a key with the account, month, year, and type, and read the total from the dictionary
                                ' we're looking up the information on the sheet using variables in memory
                                '                    d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                                     '                            "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value)) & "|" & MyAccts(acct, 3) & "|" & MyAccts(acct, 4)   'the value above the date, the SL (3) and the Code (4)
                                If InStr(MyAccts(acct, 4), "*") = 0 Then    'looks in cell for *, if found, skips
                                    SplitCodes = Split(MyAccts(acct, 4), ",")
                                    For c = LBound(SplitCodes) To UBound(SplitCodes)
                                        d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                                "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value)) & "|" & Trim(SplitCodes(c))   'the value above the date and the Code
                                        CodeCollection.Add d1    'add the key to the collection
                                    Next c
                                Else
                                    d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                            "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value))    'the value above the date
                                    CodeCollection.Add d1
                                End If
                                'because the data is not consecutive by row or columns,
                                'I have to write short arrays to the sheet.
                                'logic to figure out if i need to create a fresh array or continue to populate the current
                                If mdate = 1 Then
                                    bCurrentArray = True
                                ElseIf DateCols(mdate) = DateCols(mdate - 1) + 1 Then
                                    bCurrentArray = True
                                Else
                                    bCurrentArray = False
                                End If
                                'handles the array
                                If bCurrentArray Then
                                    If Not IsArray(ResultsArray) Or bResetArray Then
                                        'start a new array
                                        FirstColumn = DateCols(mdate)
                                        ReDim ResultsArray(1 To 1)
                                        bResetArray = False
                                    Else    'continue to use the current array
                                        ReDim Preserve ResultsArray(1 To UBound(ResultsArray) + 1)
                                    End If
                                Else
                                    'dump the current array for the row & columns
                                    'it's dumping the array for the previous set of dates
                                    .Cells(MyAccts(1, 1).Offset(acct - 1).Row, FirstColumn).Resize(, UBound(ResultsArray)).Value = ResultsArray
                                    'and start a new array
                                    FirstColumn = DateCols(mdate)
                                    ReDim ResultsArray(1 To 1)
                                    bResetArray = False
                                End If
                                'loop through the collection of lookups and sum the returned values
                                'since * codes only allow for a single return values, there is no summing
                                For c = 1 To CodeCollection.Count
                                    If MyAccts(acct, 4) <> "*" Then
                                        If IsEmpty(MyFilter(CodeCollection(c))) Then
                                            ResultsArray(UBound(ResultsArray)) = ResultsArray(UBound(ResultsArray)) + 0
                                        Else
                                            ResultsArray(UBound(ResultsArray)) = ResultsArray(UBound(ResultsArray)) + MyFilter(CodeCollection(c))
                                        End If
                                    Else    'is a * code, so no summing
                                        If IsEmpty(WildCardFilter(CodeCollection(c))) Then
                                            ResultsArray(UBound(ResultsArray)) = 0
                                        Else
                                            ResultsArray(UBound(ResultsArray)) = WildCardFilter(CodeCollection(c))
                                        End If
                                    End If
                                Next c
                            Next mdate
                        End If
                        bResetArray = True
                        'dump the last set of dates for the row
                        .Cells(MyAccts(1, 1).Offset(acct - 1).Row, FirstColumn).Resize(, UBound(ResultsArray)).Value = ResultsArray
                    End If
                Next acct
            End With
        End If
    Next wksReport
    RawDataWB.Close False
ErrHandler:
    If Err.Number <> 0 Then
        errMessage = errMessage & Chr(10) & "Module3.AddEmUp = " & Err.Number & ": " & Err.Description
    End If
    If Len(errMessage) > 0 Then
        MsgBox errMessage, vbInformation, "Unable to continue"
    End If
    Set cAppState = Nothing    'reset all the settings
    Application.ScreenUpdating = True
End Sub


Thank you very much.
I tried it but get an error message stating "Compile Error: Block if without End If"
I get a feeling that this may be caused by the fact that this macro uses 2 modules (I should have mentioned that earlier...my apologies). The second module (module 4) was created as a copy of the first module but has a slightly different purpose.
Below are both modules:
Module 3:
Code:
Option Explicit


Global Const Troubleshooting_Mode = False    'toggles troubleshooting options
Sub AddEmUp()
Dim wksReport As Worksheet, wksData As Worksheet
Dim MyTable As Range, myDates As Range
Dim MyParmCols As Variant, MyAccts As Range, DateCols As Variant
Dim MyData As Variant, MyParmData As Variant, mdate As Variant, mycell As Variant
Dim arrAccts
Dim MyFilter As Object, WildCardFilter As Object
Dim i As Long, j As Long, k As Long, acc As Long, c As Long
Dim d1 As String, errMessage As String, d2 As String
Dim cAppState As clsAppState
Dim acct As Long
Dim ResultsArray
Dim counter As Integer, FirstColumn As Integer
Dim bCurrentArray As Boolean, bResetArray As Boolean
Dim CodeCollection As Collection
Dim SplitCodes


If Not Troubleshooting_Mode Then
    On Error GoTo ErrHandler    'general error handling
    'turns off functionality that slows programs down
    Set cAppState = New clsAppState
    cAppState.SetState None
End If


'setting some sheet objects
Set wksData = Worksheets("Raw Data")
Set wksReport = ActiveSheet


' Define parameters
Set MyTable = wksData.Range("A1:M1")             ' Define top row of the data table, the macro figures -
'  out the bottom row based on the last non-empty cell in A


' Read the "Raw Data"
MyData = MyTable.Resize(MyTable.Resize(1, 1).Offset(Rows.Count - 1).End(xlUp).Row)


With wksReport
    'if you use 'Set' - then you're just assigning the object to a range
    'if you remove the 'Set' then you are placing the range into an array and into memory


    Set MyAccts = .Range("G14:J343")             ' This should be the column where the accounts are -
    '  set the rows to first row with an account to the -
    '  last row with an account, empty cells will be ignored
    ' expand to include the columns with the additional information to include (SL and/or Code)
    arrAccts = MyAccts    'put range into memory


    Set myDates = .Range("M12:p12, AF12:Aq12, AY12:BJ12, BR12:CC12, ck12:cv12, dd12:do12")    ' Set this to the cells with the dates, if there are gaps, -
    '  define the ranges as shown.  The "ACTUALS" or "BUDGET" -
    '  row is assumed to be above this row


    ' The parameters - can be an actual parameter or a "*" to mean -
    '  match anything - no other wildcards are supported
    ' Read the parms
    MyParmData = .Range("L2:O7")
End With


MyParmCols = Array(1, 2, 3, 4, 5, 6)                     ' The columns that the parameters relate to - in this example, -
'  the parameters on row 2 match column 1 (A) on the "Raw Data" -
'  sheet, row 3 matches column 2, row 4 matches column 3, row 5 -
'  matches nothing (0), etc.


'Put Date columns into array
'doing this to speed things up
ReDim DateCols(1 To myDates.Count)    'creating an array to fit the column numbers
For Each mycell In myDates
    i = i + 1
    DateCols(i) = mycell.Column
Next mycell


' Create a dictionary to put the totals in
Set MyFilter = CreateObject("Scripting.Dictionary")
Set WildCardFilter = CreateObject("Scripting.Dictionary")


' Read through the raw data, selecting the rows that match the parameters
For i = 1 To UBound(MyData)
    For j = 1 To UBound(MyParmData)
        If MyParmCols(j - 1) = 0 Then
            GoTo NextJ
        End If
        For k = 1 To 4
            If MyData(i, MyParmCols(j - 1)) = MyParmData(j, k) Or MyParmData(j, k) = "*" Then
                GoTo NextJ
            End If
        Next k
        GoTo NextI:
NextJ:
    Next j
    ' Found a match on all parameters, create a key with the acct, month, year, and type,then add up the total
    d1 = CLng(MyData(i, 7)) & "|" & MyData(i, 9) & "|" & MyData(i, 10) & "|" & LCase(MyData(i, 12)) & "|" & CLng(MyData(i, 13))
    MyFilter(d1) = MyFilter(d1) + MyData(i, 11)


    d2 = CLng(MyData(i, 7)) & "|" & MyData(i, 9) & "|" & MyData(i, 10) & "|" & LCase(MyData(i, 12))
    WildCardFilter(d2) = WildCardFilter(d2) + MyData(i, 11)


NextI:
Next i


counter = 1


' All totals found, now read through all the accounts/dates on the output sheet and place the totals
' code loops through the columns for each row
With wksReport
    For acct = 1 To UBound(arrAccts)    'loop through each row in the array
        '  If acct = 132 Then Stop 'test line
        If Len(Trim(arrAccts(acct, 1))) > 0 Then


            acc = Trim(arrAccts(acct, 1))    'place the Acct value in the array into a variable
            If acc <> 0 Then                ' ignore empty cells in the Accounts column
                For mdate = 1 To UBound(DateCols)    'loop through the Date columns
                    Set CodeCollection = New Collection  'reset the collection
                    'if there's a comma in column J (MyAccts(acct,4), then split it into an array and loop through the values
                    'if there's an * in the column, won't do split
                    'either way, results are added to the collection
                    'If acct = 132 And mdate = 37 Then Stop 'test line
                    ' Make a key with the account, month, year, and type, and read the total from the dictionary
                    ' we're looking up the information on the sheet using variables in memory
                    If InStr(MyAccts(acct, 4), "*") = 0 Then    'looks in cell for *, if found, skips
                        SplitCodes = Split(MyAccts(acct, 4), ",")
                        For c = LBound(SplitCodes) To UBound(SplitCodes)
                            d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                    "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value)) & "|" & Trim(SplitCodes(c))   'the value above the date and the Code
                            CodeCollection.Add d1    'add the key to the collection
                        Next c
                    Else
                        d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value))    'the value above the date
                        CodeCollection.Add d1
                    End If


                    'because the data is not consecutive by row or columns,
                    'I have to write short arrays to the sheet.


                    'logic to figure out if i need to create a fresh array or continue to populate the current
                    If mdate = 1 Then
                        bCurrentArray = True
                    ElseIf DateCols(mdate) = DateCols(mdate - 1) + 1 Then
                        bCurrentArray = True
                    Else
                        bCurrentArray = False
                    End If


                    'handles the array
                    If bCurrentArray Then
                        If Not IsArray(ResultsArray) Or bResetArray Then
                            'start a new array
                            FirstColumn = DateCols(mdate)
                            ReDim ResultsArray(1 To 1)
                            bResetArray = False
                        Else    'continue to use the current array
                            ReDim Preserve ResultsArray(1 To UBound(ResultsArray) + 1)
                        End If
                    Else
                        'dump the current array for the row & columns
                        'it's dumping the array for the previous set of dates
                        .Cells(MyAccts(1, 1).Offset(acct - 1).Row, FirstColumn).Resize(, UBound(ResultsArray)).Value = ResultsArray
                        'and start a new array
                        FirstColumn = DateCols(mdate)
                        ReDim ResultsArray(1 To 1)
                        bResetArray = False


                    End If


                    'loop through the collection of lookups and sum the returned values
                    'since * codes only allow for a single return values, there is no summing
                    For c = 1 To CodeCollection.Count
                        If MyAccts(acct, 4) <> "*" Then
                            If IsEmpty(MyFilter(CodeCollection(c))) Then
                                ResultsArray(UBound(ResultsArray)) = ResultsArray(UBound(ResultsArray)) + 0
                            Else
                                ResultsArray(UBound(ResultsArray)) = ResultsArray(UBound(ResultsArray)) + MyFilter(CodeCollection(c))


                            End If
                        Else    'is a * code, so no summing
                            If IsEmpty(WildCardFilter(CodeCollection(c))) Then
                                ResultsArray(UBound(ResultsArray)) = 0
                            Else
                                ResultsArray(UBound(ResultsArray)) = WildCardFilter(CodeCollection(c))
                            End If


                        End If
                    Next c


                Next mdate
            End If
            bResetArray = True
            'dump the last set of dates for the row
            .Cells(MyAccts(1, 1).Offset(acct - 1).Row, FirstColumn).Resize(, UBound(ResultsArray)).Value = ResultsArray
        End If
    Next acct
End With


ErrHandler:
If Err.Number <> 0 Then
    errMessage = errMessage & Chr(10) & "Module3.AddEmUp = " & Err.Number & ": " & Err.Description
End If
If Len(errMessage) > 0 Then
    MsgBox errMessage, vbInformation, "Unable to continue"
End If
Set cAppState = Nothing    'reset all the settings


Call Module4.AddEmUp


End Sub

Module 4
Code:
Option Explicit


Sub AddEmUp()
Dim wksReport As Worksheet, wksData As Worksheet
Dim MyTable As Range, myDates As Range
Dim MyParmCols As Variant, MyAccts As Range, DateCols As Variant
Dim MyData As Variant, MyParmData As Variant, mdate As Variant, mycell As Variant
Dim arrAccts
Dim MyFilter As Object, WildCardFilter As Object
Dim i As Long, j As Long, k As Long, acc As Long, c As Long
Dim d1 As String, errMessage As String, d2 As String
Dim cAppState As clsAppState
Dim acct As Long
Dim ResultsArray
Dim counter As Integer, FirstColumn As Integer
Dim bCurrentArray As Boolean, bResetArray As Boolean
Dim CodeCollection As Collection
Dim SplitCodes


If Not Troubleshooting_Mode Then
    On Error GoTo ErrHandler    'general error handling
    'turns off functionality that slows programs down
    Set cAppState = New clsAppState
    cAppState.SetState None
End If


'setting some sheet objects
Set wksData = Worksheets("Raw Data")
Set wksReport = ActiveSheet


' Define parameters
Set MyTable = wksData.Range("A1:M1")             ' Define top row of the data table, the macro figures -
'  out the bottom row based on the last non-empty cell in A


' Read the "Raw Data"
MyData = MyTable.Resize(MyTable.Resize(1, 1).Offset(Rows.Count - 1).End(xlUp).Row)


With wksReport
    'if you use 'Set' - then you're just assigning the object to a range
    'if you remove the 'Set' then you are placing the range into an array and into memory


    Set MyAccts = .Range("G344:G570")             ' This should be the column where the accounts are -
    '  set the rows to first row with an account to the -
    '  last row with an account, empty cells will be ignored
    ' expand to include the columns with the additional information to include (SL and/or Code)
    arrAccts = MyAccts    'put range into memory


    Set myDates = .Range("M12:p12, AF12:Aq12, AY12:BJ12, BR12:CC12, ck12:cv12, dd12:do12")    ' Set this to the cells with the dates, if there are gaps, -
    '  define the ranges as shown.  The "ACTUALS" or "BUDGET" -
    '  row is assumed to be above this row


    ' The parameters - can be an actual parameter or a "*" to mean -
    '  match anything - no other wildcards are supported
    ' Read the parms
    MyParmData = .Range("L2:O7")
End With


MyParmCols = Array(1, 2, 3, 4, 5, 6)                     ' The columns that the parameters relate to - in this example, -
'  the parameters on row 2 match column 1 (A) on the "Raw Data" -
'  sheet, row 3 matches column 2, row 4 matches column 3, row 5 -
'  matches nothing (0), etc.


'Put Date columns into array
'doing this to speed things up
ReDim DateCols(1 To myDates.Count)    'creating an array to fit the column numbers
For Each mycell In myDates
    i = i + 1
    DateCols(i) = mycell.Column
Next mycell


' Create a dictionary to put the totals in
Set MyFilter = CreateObject("Scripting.Dictionary")
Set WildCardFilter = CreateObject("Scripting.Dictionary")


' Read through the raw data, selecting the rows that match the parameters
For i = 1 To UBound(MyData)
    For j = 1 To UBound(MyParmData)
        If MyParmCols(j - 1) = 0 Then
            GoTo NextJ
        End If
        For k = 1 To 4
            If j = 3 Then
                MyParmData(3, k) = "145"
            End If
            If MyData(i, MyParmCols(j - 1)) = MyParmData(j, k) Or MyParmData(j, k) = "*" Then
                GoTo NextJ
            End If
        Next k
        GoTo NextI:
NextJ:
    Next j


    ' Found a match on all parameters, create a key with the acct, month, year, and type,then add up the total
    d1 = CLng(MyData(i, 7)) & "|" & MyData(i, 9) & "|" & MyData(i, 10) & "|" & LCase(MyData(i, 12)) & "|" & CLng(MyData(i, 13))
    MyFilter(d1) = MyFilter(d1) + MyData(i, 11)


    'create a key with acct, month, year - this is for records that have an * for the Code (hierarchy)
    d2 = CLng(MyData(i, 7)) & "|" & MyData(i, 9) & "|" & MyData(i, 10) & "|" & LCase(MyData(i, 12))
    WildCardFilter(d2) = WildCardFilter(d2) + MyData(i, 11)


NextI:
Next i


counter = 1


' All totals found, now read through all the accounts/dates on the output sheet and place the totals
' code loops through the columns for each row
With wksReport
    For acct = 1 To UBound(arrAccts)    'loop through each row in the array
        ' If acct = 132 Then Stop
        If Len(Trim(arrAccts(acct, 1))) > 0 Then


            acc = Trim(arrAccts(acct, 1))    'place the Acct value in the array into a variable
            If acc <> 0 Then                ' ignore empty cells in the Accounts column
                For mdate = 1 To UBound(DateCols)    'loop through the Date columns
                    Set CodeCollection = New Collection  'reset the collection


                    ' Make a key with the account, month, year, and type, and read the total from the dictionary
                    ' we're looking up the information on the sheet using variables in memory
                    '                    d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                         '                            "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value)) & "|" & MyAccts(acct, 3) & "|" & MyAccts(acct, 4)   'the value above the date, the SL (3) and the Code (4)


                    If InStr(MyAccts(acct, 4), "*") = 0 Then    'looks in cell for *, if found, skips
                        SplitCodes = Split(MyAccts(acct, 4), ",")
                        For c = LBound(SplitCodes) To UBound(SplitCodes)
                            d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                    "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value)) & "|" & Trim(SplitCodes(c))   'the value above the date and the Code
                            CodeCollection.Add d1    'add the key to the collection
                        Next c
                    Else
                        d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value))    'the value above the date
                        CodeCollection.Add d1
                    End If


                    'because the data is not consecutive by row or columns,
                    'I have to write short arrays to the sheet.


                    'logic to figure out if i need to create a fresh array or continue to populate the current
                    If mdate = 1 Then
                        bCurrentArray = True
                    ElseIf DateCols(mdate) = DateCols(mdate - 1) + 1 Then
                        bCurrentArray = True
                    Else
                        bCurrentArray = False
                    End If


                    'handles the array
                    If bCurrentArray Then
                        If Not IsArray(ResultsArray) Or bResetArray Then
                            'start a new array
                            FirstColumn = DateCols(mdate)
                            ReDim ResultsArray(1 To 1)
                            bResetArray = False
                        Else    'continue to use the current array
                            ReDim Preserve ResultsArray(1 To UBound(ResultsArray) + 1)
                        End If
                    Else
                        'dump the current array for the row & columns
                        'it's dumping the array for the previous set of dates
                        .Cells(MyAccts(1, 1).Offset(acct - 1).Row, FirstColumn).Resize(, UBound(ResultsArray)).Value = ResultsArray
                        'and start a new array
                        FirstColumn = DateCols(mdate)
                        ReDim ResultsArray(1 To 1)
                        bResetArray = False


                    End If


                    'loop through the collection of lookups and sum the returned values
                    'since * codes only allow for a single return values, there is no summing
                    For c = 1 To CodeCollection.Count
                        If MyAccts(acct, 4) <> "*" Then
                            If IsEmpty(MyFilter(CodeCollection(c))) Then
                                ResultsArray(UBound(ResultsArray)) = ResultsArray(UBound(ResultsArray)) + 0
                            Else
                                ResultsArray(UBound(ResultsArray)) = ResultsArray(UBound(ResultsArray)) + MyFilter(CodeCollection(c))


                            End If
                        Else    'is a * code, so no summing
                            If IsEmpty(WildCardFilter(CodeCollection(c))) Then
                                ResultsArray(UBound(ResultsArray)) = 0
                            Else
                                ResultsArray(UBound(ResultsArray)) = WildCardFilter(CodeCollection(c))
                            End If


                        End If
                    Next c


                Next mdate
            End If
            bResetArray = True
            'dump the last set of dates for the row
            .Cells(MyAccts(1, 1).Offset(acct - 1).Row, FirstColumn).Resize(, UBound(ResultsArray)).Value = ResultsArray
        End If




    Next acct
End With


ErrHandler:
If Err.Number <> 0 Then
    errMessage = errMessage & Chr(10) & "Module3.AddEmUp = " & Err.Number & ": " & Err.Description
End If
If Len(errMessage) > 0 Then
    MsgBox errMessage, vbInformation, "Unable to continue"
End If
Set cAppState = Nothing    'reset all the settings


End Sub


'Sub AddEmUp()
'Dim MyTable As Range, MyAccts As Range, myDates As Range, MyParms As Range, MyParmCols As Variant
'Dim MyData As Variant, MyParmData As Variant, MyFilter As Object
'Dim i As Long, j As Long, k As Long, d1 As String, acct As Variant, acc As Long, mdate As Variant
'
'
'' Define parameters
'    Set MyTable = Sheets("Raw Data").Range("A1:M1")             ' Define top row of the data table, the macro figures -
'                                                                '  out the bottom row based on the last non-empty cell in A
'    Set MyAccts = Sheets("Sheet2").Range("G336:G570")             ' This should be the column where the accounts are -
'                                                                '  set the rows to first row with an account to the -
'                                                                '  last row with an account, empty cells will be ignored
'    Set myDates = Sheets("Sheet2").Range("M12:X12, AF12:AQ12, AY12:BJ12, BR12:CC12")    ' Set this to the cells with the dates, if there are gaps, -
'                                                                '  define the ranges as shown.  The "ACTUALS" or "BUDGET" -
'                                                                '  row is assumed to be above this row
'    Set MyParms = Sheets("Sheet2").Range("L2:O7")               ' The parameters - can be an actual parameter or a "*" to mean -
'                                                                '  match anything - no other wildcards are supported
'    MyParmCols = Array(1, 2, 0, 4, 5, 6)                     ' The columns that the parameters relate to - in this example, -
'                                                                '  the parameters on row 2 match column 1 (A) on the "Raw Data" -
'                                                                '  sheet, row 3 matches column 2, row 4 matches column 3, row 5 -
'                                                                '  matches nothing (0), etc.
'
'' Read the "Raw Data"
'    MyData = MyTable.Resize(MyTable.Resize(1, 1).Offset(Rows.Count - 1).End(xlUp).Row).Value
'' Read the parms
'    MyParmData = MyParms.Value
'' Create a dictionary to put the totals in
'    Set MyFilter = CreateObject("Scripting.Dictionary")
'
'' Read through the raw data, selecting the rows that match the parameters
'    For i = 1 To UBound(MyData)
'
'            For j = 1 To MyParms.Rows.Count
'                If MyParmCols(j - 1) = 0 Then GoTo NextJ:
'                For k = 1 To 4
'                    If MyData(i, MyParmCols(j - 1)) = MyParms(j, k) Or MyParms(j, k) = "*" Then GoTo NextJ:
'                Next k
'                GoTo NextI:
'NextJ:
'            Next j
'' Found a match on all parameters, create a key with the acct, month, year, and type,then add up the total
'            d1 = CLng(MyData(i, 7)) & "|" & MyData(i, 9) & "|" & MyData(i, 10) & "|" & LCase(MyData(i, 12)) & "|" & CLng(MyData(i, 13)) & "|" & CLng(MyData(i, 3))
'            MyFilter(d1) = MyFilter(d1) + MyData(i, 11)
'
'NextI:
'    Next i
'
'' All totals found, now read through all the accounts/dates on the output sheet and place the totals
'    Application.ScreenUpdating = False
'    For Each acct In MyAccts
'        acc = acct.Value
'        If acc <> 0 Then                ' ignore empty cells in the Accounts column
'            For Each mdate In myDates
'' Make a key with the account, month, year, and type, and read the total from the dictionary
'                d1 = CLng(acct) & "|" & Month(mdate) & "|" & Year(mdate) & "|" & LCase(CStr(mdate.Offset(-1))) & "|" & acct.Offset(, 3) & "|" & acct.Offset(, 2)
'                Cells(acct.Row, mdate.Column) = MyFilter(d1)
'            Next mdate
'        End If
'    Next acct
'    Application.ScreenUpdating = True
'
'End Sub
'

These are the modules, adjusted for the coding that you provided:
Module 3 adjusted:
Code:
Option Explicit


Global Const Troubleshooting_Mode = False    'toggles troubleshooting options
Sub AddEmUp()
Dim wksReport As Worksheet, wksData As Worksheet, desWB As Workbook
Set desWB = ThisWorkbook
Dim MyTable As Range, myDates As Range
Dim MyParmCols As Variant, MyAccts As Range, DateCols As Variant
Dim MyData As Variant, MyParmData As Variant, mdate As Variant, mycell As Variant
Dim arrAccts
Dim MyFilter As Object, WildCardFilter As Object
Dim i As Long, j As Long, k As Long, acc As Long, c As Long
Dim d1 As String, errMessage As String, d2 As String
Dim cAppState As clsAppState
Dim acct As Long
Dim ResultsArray
Dim counter As Integer, FirstColumn As Integer
Dim bCurrentArray As Boolean, bResetArray As Boolean
Dim CodeCollection As Collection
Dim SplitCodes
Dim RawDataWB As Workbook


If Not Troubleshooting_Mode Then
    On Error GoTo ErrHandler    'general error handling
    'turns off functionality that slows programs down
    Set cAppState = New clsAppState
    cAppState.SetState None
End If


'setting some sheet objects
Set RawDataWB = Workbooks.Open("S:\Shared Folders\FP&A 7yr\07-CCS\Forecasts\2019\Management Month End Check Tool\Raw Data.xlsb")
Set wksData = Worksheets("Raw Data")
For Each wksReport In desWB.Sheets
If wksReport.Range("L1") = "x" Then


' Define parameters
Set MyTable = wksData.Range("A1:M1")             ' Define top row of the data table, the macro figures -
'  out the bottom row based on the last non-empty cell in A


' Read the "Raw Data"
MyData = MyTable.Resize(MyTable.Resize(1, 1).Offset(Rows.Count - 1).End(xlUp).Row)


With wksReport
    'if you use 'Set' - then you're just assigning the object to a range
    'if you remove the 'Set' then you are placing the range into an array and into memory


    Set MyAccts = .Range("G14:J343")             ' This should be the column where the accounts are -
    '  set the rows to first row with an account to the -
    '  last row with an account, empty cells will be ignored
    ' expand to include the columns with the additional information to include (SL and/or Code)
    arrAccts = MyAccts    'put range into memory


    Set myDates = .Range("M12:p12, AF12:Aq12, AY12:BJ12, BR12:CC12, ck12:cv12, dd12:do12")    ' Set this to the cells with the dates, if there are gaps, -
    '  define the ranges as shown.  The "ACTUALS" or "BUDGET" -
    '  row is assumed to be above this row


    ' The parameters - can be an actual parameter or a "*" to mean -
    '  match anything - no other wildcards are supported
    ' Read the parms
    MyParmData = .Range("L2:O7")
End With


MyParmCols = Array(1, 2, 3, 4, 5, 6)                     ' The columns that the parameters relate to - in this example, -
'  the parameters on row 2 match column 1 (A) on the "Raw Data" -
'  sheet, row 3 matches column 2, row 4 matches column 3, row 5 -
'  matches nothing (0), etc.


'Put Date columns into array
'doing this to speed things up
ReDim DateCols(1 To myDates.Count)    'creating an array to fit the column numbers
For Each mycell In myDates
    i = i + 1
    DateCols(i) = mycell.Column
Next mycell


' Create a dictionary to put the totals in
Set MyFilter = CreateObject("Scripting.Dictionary")
Set WildCardFilter = CreateObject("Scripting.Dictionary")


' Read through the raw data, selecting the rows that match the parameters
For i = 1 To UBound(MyData)
    For j = 1 To UBound(MyParmData)
        If MyParmCols(j - 1) = 0 Then
            GoTo NextJ
        End If
        For k = 1 To 4
            If MyData(i, MyParmCols(j - 1)) = MyParmData(j, k) Or MyParmData(j, k) = "*" Then
                GoTo NextJ
            End If
        Next k
        GoTo NextI:
NextJ:
    Next j
    ' Found a match on all parameters, create a key with the acct, month, year, and type,then add up the total
    d1 = CLng(MyData(i, 7)) & "|" & MyData(i, 9) & "|" & MyData(i, 10) & "|" & LCase(MyData(i, 12)) & "|" & CLng(MyData(i, 13))
    MyFilter(d1) = MyFilter(d1) + MyData(i, 11)


    d2 = CLng(MyData(i, 7)) & "|" & MyData(i, 9) & "|" & MyData(i, 10) & "|" & LCase(MyData(i, 12))
    WildCardFilter(d2) = WildCardFilter(d2) + MyData(i, 11)


NextI:
Next i


counter = 1


' All totals found, now read through all the accounts/dates on the output sheet and place the totals
' code loops through the columns for each row
With wksReport
    For acct = 1 To UBound(arrAccts)    'loop through each row in the array
        '  If acct = 132 Then Stop 'test line
        If Len(Trim(arrAccts(acct, 1))) > 0 Then


            acc = Trim(arrAccts(acct, 1))    'place the Acct value in the array into a variable
            If acc <> 0 Then                ' ignore empty cells in the Accounts column
                For mdate = 1 To UBound(DateCols)    'loop through the Date columns
                    Set CodeCollection = New Collection  'reset the collection
                    'if there's a comma in column J (MyAccts(acct,4), then split it into an array and loop through the values
                    'if there's an * in the column, won't do split
                    'either way, results are added to the collection
                    'If acct = 132 And mdate = 37 Then Stop 'test line
                    ' Make a key with the account, month, year, and type, and read the total from the dictionary
                    ' we're looking up the information on the sheet using variables in memory
                    If InStr(MyAccts(acct, 4), "*") = 0 Then    'looks in cell for *, if found, skips
                        SplitCodes = Split(MyAccts(acct, 4), ",")
                        For c = LBound(SplitCodes) To UBound(SplitCodes)
                            d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                    "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value)) & "|" & Trim(SplitCodes(c))   'the value above the date and the Code
                            CodeCollection.Add d1    'add the key to the collection
                        Next c
                    Else
                        d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value))    'the value above the date
                        CodeCollection.Add d1
                    End If


                    'because the data is not consecutive by row or columns,
                    'I have to write short arrays to the sheet.


                    'logic to figure out if i need to create a fresh array or continue to populate the current
                    If mdate = 1 Then
                        bCurrentArray = True
                    ElseIf DateCols(mdate) = DateCols(mdate - 1) + 1 Then
                        bCurrentArray = True
                    Else
                        bCurrentArray = False
                    End If


                    'handles the array
                    If bCurrentArray Then
                        If Not IsArray(ResultsArray) Or bResetArray Then
                            'start a new array
                            FirstColumn = DateCols(mdate)
                            ReDim ResultsArray(1 To 1)
                            bResetArray = False
                        Else    'continue to use the current array
                            ReDim Preserve ResultsArray(1 To UBound(ResultsArray) + 1)
                        End If
                    Else
                        'dump the current array for the row & columns
                        'it's dumping the array for the previous set of dates
                        .Cells(MyAccts(1, 1).Offset(acct - 1).Row, FirstColumn).Resize(, UBound(ResultsArray)).Value = ResultsArray
                        'and start a new array
                        FirstColumn = DateCols(mdate)
                        ReDim ResultsArray(1 To 1)
                        bResetArray = False


                    End If


                    'loop through the collection of lookups and sum the returned values
                    'since * codes only allow for a single return values, there is no summing
                    For c = 1 To CodeCollection.Count
                        If MyAccts(acct, 4) <> "*" Then
                            If IsEmpty(MyFilter(CodeCollection(c))) Then
                                ResultsArray(UBound(ResultsArray)) = ResultsArray(UBound(ResultsArray)) + 0
                            Else
                                ResultsArray(UBound(ResultsArray)) = ResultsArray(UBound(ResultsArray)) + MyFilter(CodeCollection(c))


                            End If
                        Else    'is a * code, so no summing
                            If IsEmpty(WildCardFilter(CodeCollection(c))) Then
                                ResultsArray(UBound(ResultsArray)) = 0
                            Else
                                ResultsArray(UBound(ResultsArray)) = WildCardFilter(CodeCollection(c))
                            End If


                        End If
                    Next c


                Next mdate
            End If
            bResetArray = True
            'dump the last set of dates for the row
            .Cells(MyAccts(1, 1).Offset(acct - 1).Row, FirstColumn).Resize(, UBound(ResultsArray)).Value = ResultsArray
        End If
    Next acct
End With


ErrHandler:
If Err.Number <> 0 Then
    errMessage = errMessage & Chr(10) & "Module3.AddEmUp = " & Err.Number & ": " & Err.Description
End If
If Len(errMessage) > 0 Then
    MsgBox errMessage, vbInformation, "Unable to continue"
End If
Set cAppState = Nothing    'reset all the settings


Application.ScreenUpdating = True


Call Module4.AddEmUp




End Sub

Module 4, adjusted:
Code:
Option Explicit


Sub AddEmUp()
Dim wksReport As Worksheet, wksData As Worksheet, desWB As Workbook
Set desWB = ThisWorkbook
Dim MyTable As Range, myDates As Range
Dim MyParmCols As Variant, MyAccts As Range, DateCols As Variant
Dim MyData As Variant, MyParmData As Variant, mdate As Variant, mycell As Variant
Dim arrAccts
Dim MyFilter As Object, WildCardFilter As Object
Dim i As Long, j As Long, k As Long, acc As Long, c As Long
Dim d1 As String, errMessage As String, d2 As String
Dim cAppState As clsAppState
Dim acct As Long
Dim ResultsArray
Dim counter As Integer, FirstColumn As Integer
Dim bCurrentArray As Boolean, bResetArray As Boolean
Dim CodeCollection As Collection
Dim SplitCodes
Dim RawDataWB As Workbook
Application.ScreenUpdating = False


If Not Troubleshooting_Mode Then
    On Error GoTo ErrHandler    'general error handling
    'turns off functionality that slows programs down
    Set cAppState = New clsAppState
    cAppState.SetState None
End If


'setting some sheet objects
Set RawDataWB = Workbooks.Open("S:\Shared Folders\FP&A 7yr\07-CCS\Forecasts\2019\Management Month End Check Tool\Raw Data.xlsb")
Set wksData = Worksheets("Raw Data")
For Each wksReport In desWB.Sheets
If wksReport.Range("L1") = "x" Then


' Define parameters
Set MyTable = wksData.Range("A1:M1")             ' Define top row of the data table, the macro figures -
'  out the bottom row based on the last non-empty cell in A


' Read the "Raw Data"
MyData = MyTable.Resize(MyTable.Resize(1, 1).Offset(Rows.Count - 1).End(xlUp).Row)


With wksReport
    'if you use 'Set' - then you're just assigning the object to a range
    'if you remove the 'Set' then you are placing the range into an array and into memory


    Set MyAccts = .Range("G344:G570")             ' This should be the column where the accounts are -
    '  set the rows to first row with an account to the -
    '  last row with an account, empty cells will be ignored
    ' expand to include the columns with the additional information to include (SL and/or Code)
    arrAccts = MyAccts    'put range into memory


    Set myDates = .Range("M12:p12, AF12:Aq12, AY12:BJ12, BR12:CC12, ck12:cv12, dd12:do12")    ' Set this to the cells with the dates, if there are gaps, -
    '  define the ranges as shown.  The "ACTUALS" or "BUDGET" -
    '  row is assumed to be above this row


    ' The parameters - can be an actual parameter or a "*" to mean -
    '  match anything - no other wildcards are supported
    ' Read the parms
    MyParmData = .Range("L2:O7")
End With


MyParmCols = Array(1, 2, 3, 4, 5, 6)                     ' The columns that the parameters relate to - in this example, -
'  the parameters on row 2 match column 1 (A) on the "Raw Data" -
'  sheet, row 3 matches column 2, row 4 matches column 3, row 5 -
'  matches nothing (0), etc.


'Put Date columns into array
'doing this to speed things up
ReDim DateCols(1 To myDates.Count)    'creating an array to fit the column numbers
For Each mycell In myDates
    i = i + 1
    DateCols(i) = mycell.Column
Next mycell


' Create a dictionary to put the totals in
Set MyFilter = CreateObject("Scripting.Dictionary")
Set WildCardFilter = CreateObject("Scripting.Dictionary")


' Read through the raw data, selecting the rows that match the parameters
For i = 1 To UBound(MyData)
    For j = 1 To UBound(MyParmData)
        If MyParmCols(j - 1) = 0 Then
            GoTo NextJ
        End If
        For k = 1 To 4
            If j = 3 Then
                MyParmData(3, k) = "145"
            End If
            If MyData(i, MyParmCols(j - 1)) = MyParmData(j, k) Or MyParmData(j, k) = "*" Then
                GoTo NextJ
            End If
        Next k
        GoTo NextI:
NextJ:
    Next j


    ' Found a match on all parameters, create a key with the acct, month, year, and type,then add up the total
    d1 = CLng(MyData(i, 7)) & "|" & MyData(i, 9) & "|" & MyData(i, 10) & "|" & LCase(MyData(i, 12)) & "|" & CLng(MyData(i, 13))
    MyFilter(d1) = MyFilter(d1) + MyData(i, 11)


    'create a key with acct, month, year - this is for records that have an * for the Code (hierarchy)
    d2 = CLng(MyData(i, 7)) & "|" & MyData(i, 9) & "|" & MyData(i, 10) & "|" & LCase(MyData(i, 12))
    WildCardFilter(d2) = WildCardFilter(d2) + MyData(i, 11)


NextI:
Next i


counter = 1


' All totals found, now read through all the accounts/dates on the output sheet and place the totals
' code loops through the columns for each row
With wksReport
    For acct = 1 To UBound(arrAccts)    'loop through each row in the array
        ' If acct = 132 Then Stop
        If Len(Trim(arrAccts(acct, 1))) > 0 Then


            acc = Trim(arrAccts(acct, 1))    'place the Acct value in the array into a variable
            If acc <> 0 Then                ' ignore empty cells in the Accounts column
                For mdate = 1 To UBound(DateCols)    'loop through the Date columns
                    Set CodeCollection = New Collection  'reset the collection


                    ' Make a key with the account, month, year, and type, and read the total from the dictionary
                    ' we're looking up the information on the sheet using variables in memory
                    '                    d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                         '                            "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value)) & "|" & MyAccts(acct, 3) & "|" & MyAccts(acct, 4)   'the value above the date, the SL (3) and the Code (4)


                    If InStr(MyAccts(acct, 4), "*") = 0 Then    'looks in cell for *, if found, skips
                        SplitCodes = Split(MyAccts(acct, 4), ",")
                        For c = LBound(SplitCodes) To UBound(SplitCodes)
                            d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                    "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value)) & "|" & Trim(SplitCodes(c))   'the value above the date and the Code
                            CodeCollection.Add d1    'add the key to the collection
                        Next c
                    Else
                        d1 = CLng(acc) & "|" & Month(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & "|" & Year(.Cells(myDates(1, 1).Row, DateCols(mdate)).Value) & _
                                "|" & LCase(CStr(.Cells(myDates(1, 1).Row, DateCols(mdate)).Offset(-1).Value))    'the value above the date
                        CodeCollection.Add d1
                    End If


                    'because the data is not consecutive by row or columns,
                    'I have to write short arrays to the sheet.


                    'logic to figure out if i need to create a fresh array or continue to populate the current
                    If mdate = 1 Then
                        bCurrentArray = True
                    ElseIf DateCols(mdate) = DateCols(mdate - 1) + 1 Then
                        bCurrentArray = True
                    Else
                        bCurrentArray = False
                    End If


                    'handles the array
                    If bCurrentArray Then
                        If Not IsArray(ResultsArray) Or bResetArray Then
                            'start a new array
                            FirstColumn = DateCols(mdate)
                            ReDim ResultsArray(1 To 1)
                            bResetArray = False
                        Else    'continue to use the current array
                            ReDim Preserve ResultsArray(1 To UBound(ResultsArray) + 1)
                        End If
                    Else
                        'dump the current array for the row & columns
                        'it's dumping the array for the previous set of dates
                        .Cells(MyAccts(1, 1).Offset(acct - 1).Row, FirstColumn).Resize(, UBound(ResultsArray)).Value = ResultsArray
                        'and start a new array
                        FirstColumn = DateCols(mdate)
                        ReDim ResultsArray(1 To 1)
                        bResetArray = False


                    End If


                    'loop through the collection of lookups and sum the returned values
                    'since * codes only allow for a single return values, there is no summing
                    For c = 1 To CodeCollection.Count
                        If MyAccts(acct, 4) <> "*" Then
                            If IsEmpty(MyFilter(CodeCollection(c))) Then
                                ResultsArray(UBound(ResultsArray)) = ResultsArray(UBound(ResultsArray)) + 0
                            Else
                                ResultsArray(UBound(ResultsArray)) = ResultsArray(UBound(ResultsArray)) + MyFilter(CodeCollection(c))


                            End If
                        Else    'is a * code, so no summing
                            If IsEmpty(WildCardFilter(CodeCollection(c))) Then
                                ResultsArray(UBound(ResultsArray)) = 0
                            Else
                                ResultsArray(UBound(ResultsArray)) = WildCardFilter(CodeCollection(c))
                            End If


                        End If
                    Next c


                Next mdate
            End If
            bResetArray = True
            'dump the last set of dates for the row
            .Cells(MyAccts(1, 1).Offset(acct - 1).Row, FirstColumn).Resize(, UBound(ResultsArray)).Value = ResultsArray
        End If




    Next acct
End With


ErrHandler:
If Err.Number <> 0 Then
    errMessage = errMessage & Chr(10) & "Module3.AddEmUp = " & Err.Number & ": " & Err.Description
End If
If Len(errMessage) > 0 Then
    MsgBox errMessage, vbInformation, "Unable to continue"
End If
Set cAppState = Nothing    'reset all the settings
Application.ScreenUpdating = True
End Sub


'Sub AddEmUp()
'Dim MyTable As Range, MyAccts As Range, myDates As Range, MyParms As Range, MyParmCols As Variant
'Dim MyData As Variant, MyParmData As Variant, MyFilter As Object
'Dim i As Long, j As Long, k As Long, d1 As String, acct As Variant, acc As Long, mdate As Variant
'
'
'' Define parameters
'    Set MyTable = Sheets("Raw Data").Range("A1:M1")             ' Define top row of the data table, the macro figures -
'                                                                '  out the bottom row based on the last non-empty cell in A
'    Set MyAccts = Sheets("Sheet2").Range("G336:G570")             ' This should be the column where the accounts are -
'                                                                '  set the rows to first row with an account to the -
'                                                                '  last row with an account, empty cells will be ignored
'    Set myDates = Sheets("Sheet2").Range("M12:X12, AF12:AQ12, AY12:BJ12, BR12:CC12")    ' Set this to the cells with the dates, if there are gaps, -
'                                                                '  define the ranges as shown.  The "ACTUALS" or "BUDGET" -
'                                                                '  row is assumed to be above this row
'    Set MyParms = Sheets("Sheet2").Range("L2:O7")               ' The parameters - can be an actual parameter or a "*" to mean -
'                                                                '  match anything - no other wildcards are supported
'    MyParmCols = Array(1, 2, 0, 4, 5, 6)                     ' The columns that the parameters relate to - in this example, -
'                                                                '  the parameters on row 2 match column 1 (A) on the "Raw Data" -
'                                                                '  sheet, row 3 matches column 2, row 4 matches column 3, row 5 -
'                                                                '  matches nothing (0), etc.
'
'' Read the "Raw Data"
'    MyData = MyTable.Resize(MyTable.Resize(1, 1).Offset(Rows.Count - 1).End(xlUp).Row).Value
'' Read the parms
'    MyParmData = MyParms.Value
'' Create a dictionary to put the totals in
'    Set MyFilter = CreateObject("Scripting.Dictionary")
'
'' Read through the raw data, selecting the rows that match the parameters
'    For i = 1 To UBound(MyData)
'
'            For j = 1 To MyParms.Rows.Count
'                If MyParmCols(j - 1) = 0 Then GoTo NextJ:
'                For k = 1 To 4
'                    If MyData(i, MyParmCols(j - 1)) = MyParms(j, k) Or MyParms(j, k) = "*" Then GoTo NextJ:
'                Next k
'                GoTo NextI:
'NextJ:
'            Next j
'' Found a match on all parameters, create a key with the acct, month, year, and type,then add up the total
'            d1 = CLng(MyData(i, 7)) & "|" & MyData(i, 9) & "|" & MyData(i, 10) & "|" & LCase(MyData(i, 12)) & "|" & CLng(MyData(i, 13)) & "|" & CLng(MyData(i, 3))
'            MyFilter(d1) = MyFilter(d1) + MyData(i, 11)
'
'NextI:
'    Next i
'
'' All totals found, now read through all the accounts/dates on the output sheet and place the totals
'    Application.ScreenUpdating = False
'    For Each acct In MyAccts
'        acc = acct.Value
'        If acc <> 0 Then                ' ignore empty cells in the Accounts column
'            For Each mdate In myDates
'' Make a key with the account, month, year, and type, and read the total from the dictionary
'                d1 = CLng(acct) & "|" & Month(mdate) & "|" & Year(mdate) & "|" & LCase(CStr(mdate.Offset(-1))) & "|" & acct.Offset(, 3) & "|" & acct.Offset(, 2)
'                Cells(acct.Row, mdate.Column) = MyFilter(d1)
'            Next mdate
'        End If
'    Next acct
'    Application.ScreenUpdating = True
'
'End Sub
'
 

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
9,983
Try inserting
Code:
End If
just above
Code:
ErrHandler:
in both macros.
 

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
9,983

ADVERTISEMENT

Code:
End If
Next wksReport
just above
Code:
 ErrHandler:
Also, please use the "Reply" button instead of the "Reply With Quote" button when responding.
 

cgsierra

Board Regular
Joined
Mar 21, 2011
Messages
132
Thanks!
It started running and then it gave me the error message:
"Module3.AddEmUp=9:Subscript out of range"
I pressed Ok twice (the error poppoed up again after pressing ok the first time).
and then the Raw Data workbook opened up.
I checked the tabs and only the first worksheet with the x in cell L1 seems to be updating
 

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
9,983

ADVERTISEMENT

Without having access to your file, it's hard to see what the problem may be. Since I did not write the code, I would have to try to decipher what you are trying to do. I was simply trying to set up a loop that checks each worksheet in your workbook for the letter "x" in cell L1. If the "x" was present, then the code that you wrote would run on each sheet (wksReport). If L1 was blank, that sheet would be ignored.
 

cgsierra

Board Regular
Joined
Mar 21, 2011
Messages
132
Yes I completely understand and I appreciate all your help. I could send you the files if that is ok with you. Please let me know
 

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
9,983
Perhaps you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Include a detailed explanation of what you would like to do using a few examples from your data and referring to specific cells, rows, columns and worksheets. If the workbook contains confidential information, you could replace it with generic data.
 

cgsierra

Board Regular
Joined
Mar 21, 2011
Messages
132
Ok, I will do that. I will put that together and as soon as I'm done I will include the link here. Thank you!
 

Watch MrExcel Video

Forum statistics

Threads
1,118,812
Messages
5,574,474
Members
412,595
Latest member
slim313
Top