Need Help Editing Another Person's old Macro

crinaldi90

New Member
Joined
Feb 6, 2014
Messages
8
I am stepping into an old macro somebody else wrote that is being used for an important file and need help fixing this small error that I know somebody out there will know how to fix fairly quickly. The macro is supposed to delete the data in row 4 of each tab and move all the rows up by one to incorporate the new month’s data. However, what’s actually happening is that the month headers (in column A) aren't moving up correctly, and the numbers are doing what they should. The macro is listed below and i am listed a piece of one of the tabs from the excel doc i am working with, as you can see the labels stay the same as the numbers move up. Let me know if what I am asking makes sense and wether you have any questions.



For i = 4 To Sheets.Count


Sheets(i).Activate
If ActiveSheet.Name = "Data-Billings" Then GoTo done
ActiveSheet.Range("B5:X16").Select
Selection.Copy
Range("B4").Select
ActiveSheet.PasteSpecial Format:=3, Link:=1, DisplayAsIcon:=False, _
IconFileName:=False
Range("B1").Select

Next i

done:


End Sub


BEFORE MACRO
[TABLE="width: 1077"]
<TBODY>[TR]
[TD="colspan: 12"]Profitablity as of February 2014</SPAN>[/TD]
[/TR]
[TR]
[TD="colspan: 2"]</SPAN>[/TD]
[TD]DX</SPAN>[/TD]
[TD="colspan: 2"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Month</SPAN>[/TD]
[TD]Core Fee Revenue</SPAN>[/TD]
[TD]Production Revenue</SPAN>[/TD]
[TD]Ancillary Revenue</SPAN>[/TD]
[TD]Fulfillment Costs</SPAN>[/TD]
[TD]Freight Costs</SPAN>[/TD]
[TD]Other Costs</SPAN>[/TD]
[TD]Provision</SPAN>[/TD]
[TD]Profit</SPAN>[/TD]
[TD]Gross Sales $</SPAN>[/TD]
[TD]Net Sales $</SPAN>[/TD]
[TD]Gross Sales Units</SPAN>[/TD]
[/TR]
[TR]
[TD]Feb-13</SPAN>[/TD]
[TD] 18,586 </SPAN>[/TD]
[TD] 4,517 </SPAN>[/TD]
[TD] 4,559 </SPAN>[/TD]
[TD] 3,832 </SPAN>[/TD]
[TD] 2,140 </SPAN>[/TD]
[TD] 132 </SPAN>[/TD]
[TD] 1,337 </SPAN>[/TD]
[TD] 22,894 </SPAN>[/TD]
[TD] 165,329 </SPAN>[/TD]
[TD] 102,521 </SPAN>[/TD]
[TD] 17,081 </SPAN>[/TD]
[/TR]
[TR]
[TD]Mar-13</SPAN>[/TD]
[TD] 28,454 </SPAN>[/TD]
[TD] 1,784 </SPAN>[/TD]
[TD] 12,200 </SPAN>[/TD]
[TD] 4,353 </SPAN>[/TD]
[TD] 2,879 </SPAN>[/TD]
[TD] 262 </SPAN>[/TD]
[TD] (1,880)</SPAN>[/TD]
[TD] 33,066 </SPAN>[/TD]
[TD] 190,931 </SPAN>[/TD]
[TD] 148,066 </SPAN>[/TD]
[TD] 18,685 </SPAN>[/TD]
[/TR]
[TR]
[TD]Apr-13</SPAN>[/TD]
[TD] 27,817 </SPAN>[/TD]
[TD] 3,852 </SPAN>[/TD]
[TD] 3,785 </SPAN>[/TD]
[TD] 3,002 </SPAN>[/TD]
[TD] 2,923 </SPAN>[/TD]
[TD] 372 </SPAN>[/TD]
[TD] (840)</SPAN>[/TD]
[TD] 28,316 </SPAN>[/TD]
[TD] 189,208 </SPAN>[/TD]
[TD] 148,987 </SPAN>[/TD]
[TD] 18,850 </SPAN>[/TD]
[/TR]
[TR]
[TD]May-13</SPAN>[/TD]
[TD] 38,913 </SPAN>[/TD]
[TD] 6,009 </SPAN>[/TD]
[TD] 2,644 </SPAN>[/TD]
[TD] 4,581 </SPAN>[/TD]
[TD] 3,847 </SPAN>[/TD]
[TD] 200 </SPAN>[/TD]
[TD] (1,937)</SPAN>[/TD]
[TD] 37,001 </SPAN>[/TD]
[TD] 235,069 </SPAN>[/TD]
[TD] 199,712 </SPAN>[/TD]
[TD] 24,731 </SPAN>[/TD]
[/TR]
[TR]
[TD]Jun-13</SPAN>[/TD]
[TD] 44,535 </SPAN>[/TD]
[TD] 5,226 </SPAN>[/TD]
[TD] 2,190 </SPAN>[/TD]
[TD] 5,413 </SPAN>[/TD]
[TD] 2,989 </SPAN>[/TD]
[TD] 471 </SPAN>[/TD]
[TD] (5,669)</SPAN>[/TD]
[TD] 37,410 </SPAN>[/TD]
[TD] 259,685 </SPAN>[/TD]
[TD] 225,853 </SPAN>[/TD]
[TD] 27,878 </SPAN>[/TD]
[/TR]
[TR]
[TD]Jul-13</SPAN>[/TD]
[TD] 23,518 </SPAN>[/TD]
[TD] 2,701 </SPAN>[/TD]
[TD] 5,800 </SPAN>[/TD]
[TD] 3,614 </SPAN>[/TD]
[TD] 2,205 </SPAN>[/TD]
[TD] (19)</SPAN>[/TD]
[TD] (2,001)</SPAN>[/TD]
[TD] 24,219 </SPAN>[/TD]
[TD] 176,880 </SPAN>[/TD]
[TD] 134,312 </SPAN>[/TD]
[TD] 20,830 </SPAN>[/TD]
[/TR]
[TR]
[TD]Aug-13</SPAN>[/TD]
[TD] 36,967 </SPAN>[/TD]
[TD] 4,969 </SPAN>[/TD]
[TD] 4,073 </SPAN>[/TD]
[TD] 5,655 </SPAN>[/TD]
[TD] 3,916 </SPAN>[/TD]
[TD] 231 </SPAN>[/TD]
[TD] (3,587)</SPAN>[/TD]
[TD] 32,620 </SPAN>[/TD]
[TD] 235,226 </SPAN>[/TD]
[TD] 196,688 </SPAN>[/TD]
[TD] 30,475 </SPAN>[/TD]
[/TR]
[TR]
[TD]Sep-13</SPAN>[/TD]
[TD] 17,955 </SPAN>[/TD]
[TD] 1,511 </SPAN>[/TD]
[TD] 2,953 </SPAN>[/TD]
[TD] 2,915 </SPAN>[/TD]
[TD] 1,787 </SPAN>[/TD]
[TD] 285 </SPAN>[/TD]
[TD] 1,041 </SPAN>[/TD]
[TD] 18,474 </SPAN>[/TD]
[TD] 133,703 </SPAN>[/TD]
[TD] 100,459 </SPAN>[/TD]
[TD] 15,201 </SPAN>[/TD]
[/TR]
[TR]
[TD]Oct-13</SPAN>[/TD]
[TD] 42,704 </SPAN>[/TD]
[TD] 3,756 </SPAN>[/TD]
[TD] 4,838 </SPAN>[/TD]
[TD] 3,704 </SPAN>[/TD]
[TD] 3,776 </SPAN>[/TD]
[TD] 195 </SPAN>[/TD]
[TD] (3,016)</SPAN>[/TD]
[TD] 40,608 </SPAN>[/TD]
[TD] 261,801 </SPAN>[/TD]
[TD] 215,260 </SPAN>[/TD]
[TD] 25,073 </SPAN>[/TD]
[/TR]
[TR]
[TD]Nov-13</SPAN>[/TD]
[TD] 36,037 </SPAN>[/TD]
[TD] 5,321 </SPAN>[/TD]
[TD] 2,004 </SPAN>[/TD]
[TD] 4,881 </SPAN>[/TD]
[TD] 2,788 </SPAN>[/TD]
[TD] 434 </SPAN>[/TD]
[TD] 625 </SPAN>[/TD]
[TD] 35,885 </SPAN>[/TD]
[TD] 219,035 </SPAN>[/TD]
[TD] 187,239 </SPAN>[/TD]
[TD] 21,782 </SPAN>[/TD]
[/TR]
[TR]
[TD]Dec-13</SPAN>[/TD]
[TD] 31,906 </SPAN>[/TD]
[TD] 5,312 </SPAN>[/TD]
[TD] 3,561 </SPAN>[/TD]
[TD] 4,750 </SPAN>[/TD]
[TD] 3,011 </SPAN>[/TD]
[TD] 519 </SPAN>[/TD]
[TD] (1,266)</SPAN>[/TD]
[TD] 31,233 </SPAN>[/TD]
[TD] 200,550 </SPAN>[/TD]
[TD] 165,410 </SPAN>[/TD]
[TD] 20,756 </SPAN>[/TD]
[/TR]
[TR]
[TD]Jan-14</SPAN>[/TD]
[TD] 36,021 </SPAN>[/TD]
[TD] 1,697 </SPAN>[/TD]
[TD] 2,117 </SPAN>[/TD]
[TD] 4,473 </SPAN>[/TD]
[TD] 2,948 </SPAN>[/TD]
[TD] 336 </SPAN>[/TD]
[TD] 3,238 </SPAN>[/TD]
[TD] 35,316 </SPAN>[/TD]
[TD] 217,509 </SPAN>[/TD]
[TD] 187,987 </SPAN>[/TD]
[TD] 24,208 </SPAN>[/TD]
[/TR]
[TR]
[TD]Feb-14</SPAN>[/TD]
[TD] 11,057 </SPAN>[/TD]
[TD] 4,899 </SPAN>[/TD]
[TD] 3,450 </SPAN>[/TD]
[TD] 3,777 </SPAN>[/TD]
[TD] 1,390 </SPAN>[/TD]
[TD] 107 </SPAN>[/TD]
[TD] 1,951 </SPAN>[/TD]
[TD] 16,083 </SPAN>[/TD]
[TD] 119,736 </SPAN>[/TD]
[TD] 69,555 </SPAN>[/TD]
[TD] 14,460 </SPAN>[/TD]
[/TR]
[TR]
[TD]TTY</SPAN>[/TD]
[TD] 375,884 </SPAN>[/TD]
[TD] 47,037 </SPAN>[/TD]
[TD] 49,615 </SPAN>[/TD]
[TD] 51,118 </SPAN>[/TD]
[TD] 34,459 </SPAN>[/TD]
[TD] 3,393 </SPAN>[/TD]
[TD] (13,341)</SPAN>[/TD]
[TD] 370,231 </SPAN>[/TD]
[TD] 2,439,333 </SPAN>[/TD]
[TD] 1,979,528 </SPAN>[/TD]
[TD] 262,929 </SPAN>[/TD]
[/TR]
</TBODY><COLGROUP><COL><COL><COL span=2><COL><COL><COL><COL span=2><COL><COL><COL></COLGROUP>[/TABLE]


AFTER MACRO
[TABLE="width: 1077"]
<TBODY>[TR]
[TD="colspan: 12"]Profitablity as of February 2014</SPAN>[/TD]
[/TR]
[TR]
[TD="colspan: 2"]</SPAN>[/TD]
[TD]DX</SPAN>[/TD]
[TD="colspan: 2"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Month</SPAN>[/TD]
[TD]Core Fee Revenue</SPAN>[/TD]
[TD]Production Revenue</SPAN>[/TD]
[TD]Ancillary Revenue</SPAN>[/TD]
[TD]Fulfillment Costs</SPAN>[/TD]
[TD]Freight Costs</SPAN>[/TD]
[TD]Other Costs</SPAN>[/TD]
[TD]Provision</SPAN>[/TD]
[TD]Profit</SPAN>[/TD]
[TD]Gross Sales $</SPAN>[/TD]
[TD]Net Sales $</SPAN>[/TD]
[TD]Gross Sales Units</SPAN>[/TD]
[/TR]
[TR]
[TD]Feb-13</SPAN>[/TD]
[TD] 28,454 </SPAN>[/TD]
[TD] 1,784 </SPAN>[/TD]
[TD] 12,200 </SPAN>[/TD]
[TD] 4,353 </SPAN>[/TD]
[TD] 2,879 </SPAN>[/TD]
[TD] 262 </SPAN>[/TD]
[TD] (1,880)</SPAN>[/TD]
[TD] 33,066 </SPAN>[/TD]
[TD] 190,931 </SPAN>[/TD]
[TD] 148,066 </SPAN>[/TD]
[TD] 18,685 </SPAN>[/TD]
[/TR]
[TR]
[TD]Mar-13</SPAN>[/TD]
[TD] 27,817 </SPAN>[/TD]
[TD] 3,852 </SPAN>[/TD]
[TD] 3,785 </SPAN>[/TD]
[TD] 3,002 </SPAN>[/TD]
[TD] 2,923 </SPAN>[/TD]
[TD] 372 </SPAN>[/TD]
[TD] (840)</SPAN>[/TD]
[TD] 28,316 </SPAN>[/TD]
[TD] 189,208 </SPAN>[/TD]
[TD] 148,987 </SPAN>[/TD]
[TD] 18,850 </SPAN>[/TD]
[/TR]
[TR]
[TD]Apr-13</SPAN>[/TD]
[TD] 38,913 </SPAN>[/TD]
[TD] 6,009 </SPAN>[/TD]
[TD] 2,644 </SPAN>[/TD]
[TD] 4,581 </SPAN>[/TD]
[TD] 3,847 </SPAN>[/TD]
[TD] 200 </SPAN>[/TD]
[TD] (1,937)</SPAN>[/TD]
[TD] 37,001 </SPAN>[/TD]
[TD] 235,069 </SPAN>[/TD]
[TD] 199,712 </SPAN>[/TD]
[TD] 24,731 </SPAN>[/TD]
[/TR]
[TR]
[TD]May-13</SPAN>[/TD]
[TD] 44,535 </SPAN>[/TD]
[TD] 5,226 </SPAN>[/TD]
[TD] 2,190 </SPAN>[/TD]
[TD] 5,413 </SPAN>[/TD]
[TD] 2,989 </SPAN>[/TD]
[TD] 471 </SPAN>[/TD]
[TD] (5,669)</SPAN>[/TD]
[TD] 37,410 </SPAN>[/TD]
[TD] 259,685 </SPAN>[/TD]
[TD] 225,853 </SPAN>[/TD]
[TD] 27,878 </SPAN>[/TD]
[/TR]
[TR]
[TD]Jun-13</SPAN>[/TD]
[TD] 23,518 </SPAN>[/TD]
[TD] 2,701 </SPAN>[/TD]
[TD] 5,800 </SPAN>[/TD]
[TD] 3,614 </SPAN>[/TD]
[TD] 2,205 </SPAN>[/TD]
[TD] (19)</SPAN>[/TD]
[TD] (2,001)</SPAN>[/TD]
[TD] 24,219 </SPAN>[/TD]
[TD] 176,880 </SPAN>[/TD]
[TD] 134,312 </SPAN>[/TD]
[TD] 20,830 </SPAN>[/TD]
[/TR]
[TR]
[TD]Jul-13</SPAN>[/TD]
[TD] 36,967 </SPAN>[/TD]
[TD] 4,969 </SPAN>[/TD]
[TD] 4,073 </SPAN>[/TD]
[TD] 5,655 </SPAN>[/TD]
[TD] 3,916 </SPAN>[/TD]
[TD] 231 </SPAN>[/TD]
[TD] (3,587)</SPAN>[/TD]
[TD] 32,620 </SPAN>[/TD]
[TD] 235,226 </SPAN>[/TD]
[TD] 196,688 </SPAN>[/TD]
[TD] 30,475 </SPAN>[/TD]
[/TR]
[TR]
[TD]Aug-13</SPAN>[/TD]
[TD] 17,955 </SPAN>[/TD]
[TD] 1,511 </SPAN>[/TD]
[TD] 2,953 </SPAN>[/TD]
[TD] 2,915 </SPAN>[/TD]
[TD] 1,787 </SPAN>[/TD]
[TD] 285 </SPAN>[/TD]
[TD] 1,041 </SPAN>[/TD]
[TD] 18,474 </SPAN>[/TD]
[TD] 133,703 </SPAN>[/TD]
[TD] 100,459 </SPAN>[/TD]
[TD] 15,201 </SPAN>[/TD]
[/TR]
[TR]
[TD]Sep-13</SPAN>[/TD]
[TD] 42,704 </SPAN>[/TD]
[TD] 3,756 </SPAN>[/TD]
[TD] 4,838 </SPAN>[/TD]
[TD] 3,704 </SPAN>[/TD]
[TD] 3,776 </SPAN>[/TD]
[TD] 195 </SPAN>[/TD]
[TD] (3,016)</SPAN>[/TD]
[TD] 40,608 </SPAN>[/TD]
[TD] 261,801 </SPAN>[/TD]
[TD] 215,260 </SPAN>[/TD]
[TD] 25,073 </SPAN>[/TD]
[/TR]
[TR]
[TD]Oct-13</SPAN>[/TD]
[TD] 36,037 </SPAN>[/TD]
[TD] 5,321 </SPAN>[/TD]
[TD] 2,004 </SPAN>[/TD]
[TD] 4,881 </SPAN>[/TD]
[TD] 2,788 </SPAN>[/TD]
[TD] 434 </SPAN>[/TD]
[TD] 625 </SPAN>[/TD]
[TD] 35,885 </SPAN>[/TD]
[TD] 219,035 </SPAN>[/TD]
[TD] 187,239 </SPAN>[/TD]
[TD] 21,782 </SPAN>[/TD]
[/TR]
[TR]
[TD]Nov-13</SPAN>[/TD]
[TD] 31,906 </SPAN>[/TD]
[TD] 5,312 </SPAN>[/TD]
[TD] 3,561 </SPAN>[/TD]
[TD] 4,750 </SPAN>[/TD]
[TD] 3,011 </SPAN>[/TD]
[TD] 519 </SPAN>[/TD]
[TD] (1,266)</SPAN>[/TD]
[TD] 31,233 </SPAN>[/TD]
[TD] 200,550 </SPAN>[/TD]
[TD] 165,410 </SPAN>[/TD]
[TD] 20,756 </SPAN>[/TD]
[/TR]
[TR]
[TD]Dec-13</SPAN>[/TD]
[TD] 36,021 </SPAN>[/TD]
[TD] 1,697 </SPAN>[/TD]
[TD] 2,117 </SPAN>[/TD]
[TD] 4,473 </SPAN>[/TD]
[TD] 2,948 </SPAN>[/TD]
[TD] 336 </SPAN>[/TD]
[TD] 3,238 </SPAN>[/TD]
[TD] 35,316 </SPAN>[/TD]
[TD] 217,509 </SPAN>[/TD]
[TD] 187,987 </SPAN>[/TD]
[TD] 24,208 </SPAN>[/TD]
[/TR]
[TR]
[TD]Jan-14</SPAN>[/TD]
[TD] 11,057 </SPAN>[/TD]
[TD] 4,899 </SPAN>[/TD]
[TD] 3,450 </SPAN>[/TD]
[TD] 3,777 </SPAN>[/TD]
[TD] 1,390 </SPAN>[/TD]
[TD] 107 </SPAN>[/TD]
[TD] 1,951 </SPAN>[/TD]
[TD] 16,083 </SPAN>[/TD]
[TD] 119,736 </SPAN>[/TD]
[TD] 69,555 </SPAN>[/TD]
[TD] 14,460 </SPAN>[/TD]
[/TR]
[TR]
[TD]Feb-14</SPAN>[/TD]
[TD] 11,057 </SPAN>[/TD]
[TD] 4,899 </SPAN>[/TD]
[TD] 3,450 </SPAN>[/TD]
[TD] 3,777 </SPAN>[/TD]
[TD] 1,390 </SPAN>[/TD]
[TD] 107 </SPAN>[/TD]
[TD] 1,951 </SPAN>[/TD]
[TD] 16,083 </SPAN>[/TD]
[TD] 119,736 </SPAN>[/TD]
[TD] 69,555 </SPAN>[/TD]
[TD] 14,460 </SPAN>[/TD]
[/TR]
[TR]
[TD]TTY</SPAN>[/TD]
[TD] 358,487 </SPAN>[/TD]
[TD] 50,152 </SPAN>[/TD]
[TD] 40,865 </SPAN>[/TD]
[TD] 50,542 </SPAN>[/TD]
[TD] 32,970 </SPAN>[/TD]
[TD] 3,238 </SPAN>[/TD]
[TD] (9,510)</SPAN>[/TD]
[TD] 353,248 </SPAN>[/TD]
[TD] 2,368,138 </SPAN>[/TD]
[TD] 1,901,017 </SPAN>[/TD]
[TD] 258,704 </SPAN>[/TD]
[/TR]
</TBODY><COLGROUP><COL><COL><COL span=2><COL><COL><COL><COL span=2><COL><COL><COL></COLGROUP>[/TABLE]
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
It's not deleting anything, it's copying the data in the cells B5:X16 in to cell B4.

Do you simply want to delete row4 in the top example, just as if you were to select the row and right click and select delete from the menu or is there something else you want to do?
 
Upvote 0
If you only want to delete the fourth row, you can try this code.

Make sure to try it on a copy first.

Code:
Sub DeleteRowFour()

Dim i As Long


For i = 4 To Sheets.Count


With Sheets(i)
    
    If .Name = "Data-Billings" Then GoTo done
    .Range("4:4").Delete Shift:=xlUp
    
End With


Next i

done:


End Sub
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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