Excel Macro

tpmuser2

New Member
Joined
Oct 29, 2018
Messages
3
[TABLE="width: 1242"]
<tbody>[TR]
[TD][TABLE="width: 905"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Below is a sample of our payment register. Our check register prints the total of the check on the first line and then the account breakdown of the checks on the lines below. I need the check number and the Check Name to show up on every line of the account breakdown. I would like to create a macro that will copy the text from columns "A" and "B" and paste it to the rows below it that correspond to that particular check. I would like for the macro to continue copying the information until there are no more checks. This example has only three checks. Sometimes our payment registers have 50 checks or $100 checks. The number can vary. Can the macro continue to run until it detects no more checks in column "A"?





[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Check Number[/TD]
[TD]Check Name[/TD]
[TD]Total Check Amount[/TD]
[TD]Account Split[/TD]
[TD]Amount per Account[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]100[/TD]
[TD]Sears[/TD]
[TD]$500[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]845[/TD]
[TD]$225[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]760[/TD]
[TD]$275[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]200[/TD]
[TD]Vons[/TD]
[TD]$2,500[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]260[/TD]
[TD]$500[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]375[/TD]
[TD]$1,400[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]460[/TD]
[TD]$600[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]300[/TD]
[TD]Best Buy[/TD]
[TD]$4000[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]720[/TD]
[TD]$4,000[/TD]
[/TR]
</tbody>[/TABLE]

The final result should look like the table below:

[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Check #[/TD]
[TD]Check Name[/TD]
[TD]Total Check[/TD]
[TD]Account Split[/TD]
[TD]Amount per Account[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]100[/TD]
[TD]Sears[/TD]
[TD]$500[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]100[/TD]
[TD]Sears[/TD]
[TD][/TD]
[TD]845[/TD]
[TD]$225[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]100[/TD]
[TD]Sears[/TD]
[TD][/TD]
[TD]760[/TD]
[TD]$275[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]200[/TD]
[TD]Vons[/TD]
[TD]$2,500[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]200[/TD]
[TD]Vons[/TD]
[TD][/TD]
[TD]260[/TD]
[TD]$500[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]200[/TD]
[TD]Vons[/TD]
[TD][/TD]
[TD]375[/TD]
[TD]$1,400[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]200[/TD]
[TD]Vons[/TD]
[TD][/TD]
[TD]460[/TD]
[TD]$600[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]300[/TD]
[TD]Best Buy[/TD]
[TD]$4000[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]300[/TD]
[TD]Best Buy[/TD]
[TD][/TD]
[TD]720[/TD]
[TD]$4,000[/TD]
[/TR]
</tbody>[/TABLE]


Thank you[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited by a moderator:

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi & welcome to MrExcel
How about
Code:
Sub Filldown()
   With Range("A:B")
      .SpecialCells(xlBlanks).FormulaR1C1 = "=r[-1]c"
      .Value = .Value
   End With
      
End Sub
 
Upvote 0
I received the following error message:

Run time error '1004':
Unable to get the SpecialCells property the Range class
 
Upvote 0
Check that your "Blank" cells are actually blank.
=ISBLANK(A3)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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