Clear Cells Button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I make a button to put on a tab that will clear information in
specific cells? ie I want the button to clear (delete) any information in
cells I4, I9, I11.
 
One way:

If you use a button from the Forms toolbar, attach this macro to it
(right-click the button and choose Assign Macro):

Public Sub ClearCells
Range("I4,I0,I11").ClearContents
End Sub
 
Hi,

Click

View|Toolbars|Forms to show the forms toolbar then
Click the button tool on the toolbar and put a button on your worksheet

In the window that pops up click NEW and paste this in

Set myrange = Range("I4,I9,I11")
myrange.ClearContents


Mike
 
I sa your response to this,and I have tried it out - its brilliant. I already
have it working in a large worksheet.

One question though - Having created the button from the forms toolbar,how
can i attached a label to the button. eg "Clear down spredsheet",telling
someone to carry out this action,before updating the worksheet.

It absolutely amazes me the the knowledge out there.
Regards
Finance Guru
 
Thank you Gord. I did try that before emailing the discussion Group,but I
have now tried it again and it works.

Thanks again for help.
FG
 
Hi,

This macro works great, but how can I create a single button to clear cells for multiple sheets?

For example, I want to clear cells G6:G25 in sheet 1, sheet 2, and sheet 3 with just one click of a button.

Please let me know when you have a chance.

Thanks,

Cuong




EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com
 
One way:

Public Sub ClearRangeInThreeSheets()
Const csCellRef As String = "G6:G25"
Dim ws As Worksheet
For Each ws In Worksheets(Array("Sheet 1", "Sheet 2", "Sheet 3"))
ws.Range(csCellRef).ClearContents
Next ws
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top