CommandButton to Clear Contents

Kaiser6

New Member
Joined
Sep 7, 2011
Messages
8
:warning: I need to create a command button on sheet 1 of a workbook which clears the contents in rows 2-500 in sheets 2-9 of a workbook when it is selected.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Welcome to the Board!

You can accomplish that by recording a macro grouping the sheets, then selecting the rows and deleting them.

Feel free to post back the code that you get and someone can clean it up for you.
 
Upvote 0
Code:
Sub FJ
 
Sheets(Array([FONT=Calibri]“ACTIVE-19A”,”PENDING-19A”,”SUSPENDED-19A”,”DENIED-DOT”,”GRANTED-DOT”,”WAITING-DOT”,”Waiting for carrier response”,”NO ACTION REQUIRED”,”Blank”[/FONT]
)).Select

Range("A2:Z600").Select 
    Selection.ClearContents 

End Sub
 
[Code]
 
Can't get this code to work any ideas????????:evil:
 
Upvote 0
Code:
Sub FJ
 
Sheets(Array([FONT=Calibri]“ACTIVE-19A”,”PENDING-19A”,”SUSPENDED-19A”,”DENIED-DOT”,”GRANTED-DOT”,”WAITING-DOT”,”Waiting for carrier response”,”NO ACTION REQUIRED”,”Blank”[/FONT]
)).Select

Range("A2:Z600").Select 
    Selection.ClearContents 

End Sub

Can't get this code to work any ideas????????:evil:

When you say can't get the code to work, what do you mean?

I tried the same code (different sheet names) and it worked fine for me.

Have you tied this macro to the "on click" code for your button yet?

If not place your button and then right click and assign macro. Find your recorded macro and try that.
 
Upvote 0
compile error

syntax error

Are all of the sheet names correct?

I did test your code, albeit with sheet1, sheet2, etc and it worked for me.

Maybe some of the special characters are ruining the fun. Try renaming the tabs, renaming them in the macro to match, and try again.
 
Upvote 0

Forum statistics

Threads
1,224,537
Messages
6,179,408
Members
452,912
Latest member
alicemil

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