Macro to move data from one worksheet to another in same workbook

Mldeuser

Well-known Member
Joined
Dec 27, 2008
Messages
573
Office Version
  1. 365
Platform
  1. Windows
Is it possible to have a macro compare two wokrsheets and move the totals from one sheet to the other worksheet.

Here are the worksheets:

Excel Workbook
BCDEFG
6Balance
7as ofMisc Bill BackEstimateAdjusted
81/31/20091/31/2009AccrualsKBSTenant Balance
9
10ADP, Inc-
11Albany Molecular Research-
12Alder Biopharmaceuticals-
13Behringer USA-
14Brunni-Colbath-
15Click & Mortar Multimedia-
16Kaseya-
17Science App International-
18Seattle Avionics Software-
19Team Moose-
20Transas USA-
21Great Clips-
22Service Alternative-
23Youngzee-
24Pacific Vascular-
25Pressler Engineer-
26Word of His Grace-
27Mirabilis Medica-
28-
29-
30
31
32Per Total Aged Delinquency Balance0.000.000.000.00
33
34Tenant Rec per A/R Balance Report@01/09(A/C 1110 & 1115)0.00
35Prepaid Rent per A/R Balance Report @01/09(A/C 2065)0.00
36
370.00
38
Prepaid Delinquent



Excel Workbook
ABCDEFGHIJ
7
8Invoice DateCategorySourceAmountCurrent1 Month2 Months3 Months4 Months
9
10
11RT1308-CB0654ADP, IncMaster Occupant Id: ADP, Inc-1Day Due: 1Delq Day:
124-102CurrentLast Payment:6/29/200974,155
13
146/20/2009UTIReimbursed UtilitiesCH7,864.7807,864.78000
156/20/2009UTIReimbursed UtilitiesCH2,088.1402,088.14000
166/20/2009UTIReimbursed UtilitiesCH7,923.4407,923.44000
176/20/2009UTIReimbursed UtilitiesCH1,486.2001,486.20000
187/16/2009UTIReimbursed UtilitiesCH9,394.849,394.840000
197/16/2009UTIReimbursed UtilitiesCH722.15722.150000
207/16/2009UTIReimbursed UtilitiesCH8,180.088,180.080000
217/16/2009UTIReimbursed UtilitiesCH3,081.593,081.590000
22
23UTIReimbursed Utilities40,74121,37919,363000
24ADP, Inc Total:40,74121,37919,363000
25
26
27RT1308-CB0662Albany Molecular Research, IncMaster Occupant Id: Albany M-1Day Due: 1Delq Day:
283-101InactiveLast Payment:3/5/200978,562
29
303/18/2009OPEOperating Expense RecoveNC-180.270000-180.27
313/18/2009OPEOperating Expense RecoveNC-180.270000-180.27
323/18/2009OPEOperating Expense RecoveNC-180.270000-180.27
333/18/2009OPEOperating Expense RecoveNC-1,401.360000-1,401.36
343/18/2009OPEOperating Expense RecoveNC-1,401.360000-1,401.36
353/18/2009OPEOperating Expense RecoveNC-1,401.360000-1,401.36
365/8/2009OPYOperating Exp Recov - PYNC-12,346.0000-12,346.0000
37
38OPEOperating Expense Recove-4,7450000-4,745
39OPYOperating Exp Recov - PY-12,34600-12,34600
40Albany Molecular Research, Inc Total:-17,09100-12,3460-4,745
41
42
43RT1308-CB0666Kaseya, IncMaster Occupant Id: Kaseya-1Day Due: 1Delq Day:
441-205CurrentLast Payment:7/1/20099,613
45
467/1/2009OPEOperating Expense RecoveCH76.8576.850000
47
48OPEOperating Expense Recove77770000
49Kaseya, Inc Total:77770000
50
Aged Delinquencies


I waould like the macro to compare column "C" on the prepaid delinquent worksheet to column "A" on the Aged delinquent worksheet and where they find a match brin the total amount from column "E" on the Aged delinquent worksheet to column "D" on the Prepaid Delinquent worksheet.

Additionally if there was an entry on the Aged delinquent worksheet that it would insert a new row on the Prepaid delinquent worksheet and copy in the information from the Aged delinquent worksheet.

Any help on this would be greatly appreciated.

Thanks
Mark
 
The error was Run-time error '9'
subscript out of range
When I selected debug the following line was highlighted.

Set PrepaidNames = Sheets("Prepaid").Range("C:C")
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
I suspect that the name of the Prepaid sheet is the problem. There has to be an exact match. You may have a space at the beginning or end of the name. Select the tab as if you were going to change the name. The name will be highlighted. Copy the name and pasted it in the program in place of (“Prepaid”). Be sure to put the quote marks around it.<o:p></o:p>
<o:p></o:p>
Yes, you can change the named sheets to the code name of the sheet. If you change the named sheets in the procedure to the sheet code names this should solve the above problem.<o:p></o:p>
<o:p></o:p>
Example<o:p></o:p>
<o:p></o:p>
Code:
[COLOR=black]Set PrepaidNames = Sheets("Prepaid").Range("C:C")[/COLOR]

becomes
<o:p></o:p>

Code:
[COLOR=black]Set PrepaidNames = Sheet33.Range("C:C")[/COLOR]

<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
One last thing there is a formula in column "G" when a new row is inserted can the macro copy the formulas in column "G" to the newly inserted row.

Thanks
 
Upvote 0
Code:
            If FoundCustomer Is Nothing Then
                Range("C5").EntireRow.Insert
                Range("C5") = CustomerName
                Range("D5") = c.Offset(0, 4)
                Range("G6").Copy Range("G5")    '<<<add this line of code
            Else
 
Upvote 0
Can the macro be adjusted to clear the cells prior to bringing in the new numbers. At this time it brings in the new nubers but does not remove the old ones so the reports do not tie out.

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,121
Members
452,381
Latest member
Nova88

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