Macro to copy and delete last row in a sheet

raider33

New Member
Joined
May 28, 2010
Messages
25
Hello everyone.

I have a following problem with excel macro:

Every day I have to copy data from the first row (B1:DB1) in to first empty row in the sheet (for example B25:DB25).

Then I have to clear the data for the previous day (data in range B24:DB24 in this example. I filled it with data from the first row yesterday). But , I have to leave the the data in a cell A24 i.e. I have to clear the data only from B24:DB24. (There are dates in column "A" that I need)

I am only a begginer with VBA so I looked on the net I found this macro:


Code:
Worksheets("Daily data").Range("B1:DB1").Copy     Worksheets("Daily data").Cells(Rows.Count, "B").End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _         xlNone, SkipBlanks:=True, Transpose:=False         Application.CutCopyMode = False                        

Worksheets("Daily data").Cells(Rows.Count, "B").End(xlUp).Offset(-1, 0).EntireRow.ClearContents


However, this macro deletes everything from the row I filled up yesterday, inlcuding the data in column A (it is row 24 in this example).

How can I modify it so it would clear data only from the B24:DB24 range ?

Any help is welcome.

With Regards,

Eriol
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,224,521
Messages
6,179,278
Members
452,902
Latest member
Knuddeluff

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