Clearing with Macros

volkl77

Board Regular
Joined
Apr 5, 2008
Messages
76
I have a spreadsheet with tabs for each day of the month. I would like to set up a macro that will clear all the data I have entered to get the spreadsheet ready for the next month. Is there a way to create a macro that will clear all the data in the spreadsheet or would it be easiest to create a reference sheet and have the macro copy that sheet to all the tabs? Thanks again!
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Something like this?

Code:
Sub ResetWorksheet()

    Dim ws As Worksheet
    
    For Each ws In ThisWorkbook.Worksheets
        .Rows("2:" & Rows.Count).ClearContents
    Next ws

End Sub

This will clear every worksheet in the workbook from row 2 down.
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,799
Members
452,943
Latest member
Newbie4296

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