Calling macro experts

bigmacfann

New Member
Joined
Aug 26, 2005
Messages
44
Hello Macro geniuses! I have an easy one for you.
Each month, I get a report from Quickbooks which has all the details from each deposit we made in the previous month, it looks like this:

Deposit Detail Report - Mr Excel.xlsx
ABCDEFG
1TypeDateNumNameAccountAmount
2
3Deposit08/02/2023103 · Bank 313,575.80
4
5Payment08/02/20235262Project 11005 · Undeposited Funds-185.00
6Payment08/02/20235263Project 21005 · Undeposited Funds-145.00
7Payment08/02/20235264Project 31005 · Undeposited Funds-145.00
8Payment08/02/202310693Project 41005 · Undeposited Funds-24.25
9Payment08/02/202316835Project 51005 · Undeposited Funds-2,614.64
10Payment08/02/2023142906Project 61005 · Undeposited Funds-1,250.00
11Payment08/02/202316855Project 71005 · Undeposited Funds-590.81
12Payment08/02/2023530214Project 81005 · Undeposited Funds-322.40
13Payment08/02/2023530214Project 91005 · Undeposited Funds-2,946.70
14Payment08/02/202325166Project 101005 · Undeposited Funds-285.00
15Payment08/02/20237193729907Project 111005 · Undeposited Funds-690.00
16Payment08/02/2023311308Project 121005 · Undeposited Funds-4,223.00
17Payment08/02/20231366Project 131005 · Undeposited Funds-154.00
18TOTAL-13,575.80
19
20Deposit08/09/20231762266930Bank 4104 · Bank 41,342.00
21
22101 · Bank 1-1,342.00
23TOTAL-1,342.00
24
25Deposit08/22/2023102 · Bank 26,676.65
26
27Project 14435 · Insurance - Worker's Comp-34.50
28Payment08/22/20230000004763Project 151005 · Undeposited Funds-228.00
29Payment08/22/20237194160880Project 161005 · Undeposited Funds-598.50
30Payment08/22/2023212382Project 171005 · Undeposited Funds-1,977.25
31Payment08/22/20231980Project 181005 · Undeposited Funds-192.50
32Payment08/22/20239710Project 191005 · Undeposited Funds-172.50
33Payment08/22/20230000004757Project 201005 · Undeposited Funds-1,069.50
34Payment08/22/202313023Project 211005 · Undeposited Funds-2,403.90
35TOTAL-6,676.65
36
37Deposit08/22/20231474631884Bank 4104 · Bank 41,544.70
38
39101 · Bank 1-1,544.70
40TOTAL-1,544.70
41
42Deposit08/30/2023103 · Bank 311,475.96
43
44Payment08/30/202323005Project 221005 · Undeposited Funds-236.80
45Payment08/30/202317006Project 231005 · Undeposited Funds-5,329.10
46Payment08/30/202317006Project 241005 · Undeposited Funds-85.50
47Payment08/30/202316981Project 251005 · Undeposited Funds-844.56
48Payment08/30/202317255Project 261005 · Undeposited Funds-1,154.79
49Payment08/30/202325221Project 271005 · Undeposited Funds-148.00
50Payment08/30/202325221Project 281005 · Undeposited Funds-358.00
51Payment08/30/2023532773Project 291005 · Undeposited Funds-147.80
52Payment08/30/2023532773Project 301005 · Undeposited Funds-1,915.80
53Payment08/30/202316936Project 311005 · Undeposited Funds-817.13
54Payment08/30/202322346Project 321005 · Undeposited Funds-438.48
55TOTAL-11,475.96
56
57Deposit08/31/2023#23-007-013Bank 3103 · Bank 324.50
58
59Project 33408 · Outside Drafting Services-24.50
60TOTAL-24.50
Sheet1
Cell Formulas
RangeFormula
G18G18=ROUND(SUM(G4:G17),5)
G23,G60,G40G23=ROUND(SUM(G21:G22),5)
G35G35=ROUND(SUM(G26:G34),5)
G55G55=ROUND(SUM(G43:G54),5)


Keep in mind, this report will be different every month with varying amounts of deposit transactions at each of the 4 banks. For this report every month, I do not need the information for 'Bank 1' or 'Bank 4' which comes from Quickbooks, I only need the transactions which went into 'Bank 2' and 'Bank 3.' This is how the sheet should look once the macro completes:

Deposit Detail Report - Mr Excel.xlsx
ABC
1DateNameAmount
208/02/2023Project 1-185.00
308/02/2023Project 2-145.00
408/02/2023Project 3-145.00
508/02/2023Project 4-24.25
608/02/2023Project 5-2,614.64
708/02/2023Project 6-1,250.00
808/02/2023Project 7-590.81
908/02/2023Project 8-322.40
1008/02/2023Project 9-2,946.70
1108/02/2023Project 10-285.00
1208/02/2023Project 11-690.00
1308/02/2023Project 12-4,223.00
1408/02/2023Project 13-154.00
1508/22/2023Project 14-34.50
1608/22/2023Project 15-228.00
1708/22/2023Project 16-598.50
1808/22/2023Project 17-1,977.25
1908/22/2023Project 18-192.50
2008/22/2023Project 19-172.50
2108/22/2023Project 20-1,069.50
2208/22/2023Project 21-2,403.90
2308/30/2023Project 22-236.80
2408/30/2023Project 23-5,329.10
2508/30/2023Project 24-85.50
2608/30/2023Project 25-844.56
2708/30/2023Project 26-1,154.79
2808/30/2023Project 27-148.00
2908/30/2023Project 28-358.00
3008/30/2023Project 29-147.80
3108/30/2023Project 30-1,915.80
3208/30/2023Project 31-817.13
3308/30/2023Project 32-438.48
3408/31/2023Project 33-24.50
Sheet1 (2)


Hopefully this is pretty easy but if you have questions, please let me know.

Thank you!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I am not an expert but following might do the job for you until a real expert comes around.
Try so.
Change references where required.
Code:
Sub Maybe()
Dim lr As Long
lr = Range("A:G").Find("*", , xlValues, xlPart, xlByRows, xlPrevious).Row
Application.ScreenUpdating = False
    With Range("A1:G" & lr)
        .AutoFilter Field:=5, Criteria1:="Project" & "*"
            .Copy Sheets("Sheet2").Range("A1")
        .AutoFilter
    End With
Sheets("Sheet2").Range("A:A, B:B, D:D, F:F").Delete
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thank you jolivanes for this code! It didn't perform exactly as I was hoping. I had to make 1 modification to get it to run: I had to change Sheet2 to Sheet1 since that is the label of my worksheet.

The code did consolidate the data down to the 3 columns, but it didn't delete the transactions relating to Bank 1 and Bank 4 nor delete the blank lines.

Is someone else able to take a shot at it?

Thank
 
Upvote 0
Re: "I had to change Sheet2 to Sheet1" Hence the "Change references where required". Should be self explanatory.

Re: "Is someone else able to take a shot at it?" I hope someone else will.
 
Upvote 0
Give this a try, in a new module:

Edit: Just a side note, this is designed to work specifically with the formatting displayed in your sample only. If there are ever any changes to the formatting, the code may not function as desired.

VBA Code:
Sub Transactions()
Dim wsIn As Worksheet, wsOut As Worksheet
Set wsIn = Sheets("Input")      'change your input sheet name here
Set wsOut = Sheets("Output")    'change your destination sheet name here
Dim lr&, nr&, i&, j&, d&, amt&
lr = wsIn.Range("G" & Rows.Count).End(xlUp).Row

Application.ScreenUpdating = False

With wsIn
    .Range("D:D").Delete Shift:=xlLeft
    .Range("A:B").Delete Shift:=xlLeft
End With

For i = 1 To lr
    If wsIn.Range("A" & i).Value <> "" Then
'Change the bank names in the following line, will need to add or remove code if amount of banks <> 2
        If InStr(1, wsIn.Range("C" & i).Value, "Bank 3") Or InStr(1, wsIn.Range("C" & i).Value, "Bank 2") Then
            d = wsIn.Range("A" & i).Value
            amt = wsIn.Range("D" & i).Value
            j = i + 2
            Do While amt > 0
                With wsOut
                    nr = .Range("A" & Rows.Count).End(xlUp).Row + 1
                    .Range("A" & nr).Value = d
                    .Range("B" & nr).Value = wsIn.Range("B" & j).Value
                    .Range("C" & nr).Value = wsIn.Range("D" & j).Value
                End With
                amt = amt - Abs(wsIn.Range("D" & j).Value)
                j = j + 1
            Loop
        End If
    End If
Next i

Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,093
Messages
6,123,069
Members
449,090
Latest member
fragment

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top