Macro to Clear Data

Risque666

New Member
Joined
Nov 23, 2019
Messages
35
Office Version
  1. 2016
Platform
  1. Windows
Hi there

I am looking for a Macro that I can put on just the first sheet, that will clear all the Data entered on all 31 sheets.

So the Macro sits only on sheet 1 but clears all 31, so the start of a new month I start fresh, is there away to do this?
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
How about this.

VBA Code:
Sub ClearAll()
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual

For Each ws In ActiveWorkbook.Worksheets
    If ws.Name <> "Sheet1" Then ws.Cells.Clear 'Change for sheet you want to ignore
Next ws

Application.ScreenUpdating = True
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End Sub
 
Upvote 0
Although that does clear everything - It clears all formulas and the whole entire page including lay out & template for cashiering sheet. I just want it to clear data in particular cells over 31 sheets but using 1 macro on sheet 1 to do it.
 
Upvote 0
What cells do you want to clear out? Are they the same on all sheets?
 
Upvote 0
So the Cells are all in the same places on every page that need cleared.

Example AJ3 AJ5, AJ7 AJ9 and so on as well as many others like B1, B2 , B3 etc.
 
Upvote 0
I believe that you have not received a response as you have offered up a too vague response. For VBA to work with non- adjacent cells, we need to be very specific as to what cells to clear. Also, if you want to retain your formula then you cannot clear out cell values without an if then calculation that would place empty values in the cells containing formulas. You need to be as specific as possible to get the solution you appear to be looking for.
 
Upvote 0

Forum statistics

Threads
1,214,605
Messages
6,120,476
Members
448,967
Latest member
visheshkotha

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