+ Reply to Thread
Results 1 to 9 of 9

How to create a macro button to clear muliple cells on multiple worksheets

  1. #1
    Valued Forum Contributor
    Join Date
    06-23-2010
    Location
    North West
    MS-Off Ver
    office 2010
    Posts
    355

    How to create a macro button to clear muliple cells on multiple worksheets

    Good Evening
    I have attached a test workbook excel 2010 (please ignore ref# errors, I've cut the workbook down for uploading purposes)
    What I would like to do is have a 'Button' on my 'information Sheet' which when clicked would clear certain cells.
    I have searched the forum but can't find a solution, everyone seems to want to delete rows or columns but I just want to clear certain cells.
    The workbook will have 11 sheets each named 'caravan 1' through to 'caravan 11'
    The uploaded test workbook only only has 3 sheets.

    On 'caravan 1' (which is slightly different to the other 10) I want to clear the content of cells

    B4 & B5
    C4, C22 & C41
    D4 & D5
    E4,E5, E22,E23,E41 &E 42

    On all other 'Caravan sheets' I want to clear the contents of cells

    D4 & D5
    E4, E5, E22, E23, E41 & E42

    It would be icing on the cake if it could give a warning such as " are you sure you want to clear these cells" but that isn't really necessary.
    The worksheets will be password protected, but the cells mentioned above will not be.
    If it proves too difficult to clear all the cells on all the sheets with one click, then perhaps a simpler solution might be to have a button on each sheet instead

    Thanks
    Attached Files Attached Files
    Last edited by nje; 07-02-2014 at 03:48 PM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to create a macro button to clear muliple cells on multiple worksheets

    You did not specificity where the msg box should appear. It appears on every line before the code clears the cells.
    Attached Files Attached Files
    Last edited by AB33; 07-02-2014 at 03:59 PM.

  3. #3
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,085

    Re: How to create a macro button to clear muliple cells on multiple worksheets

    When you mention "C22 & C41" it means cells "C22" and "C41" or from "C22" to "C41"
    - Battle without fear gives no glory - Just try

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to create a macro button to clear muliple cells on multiple worksheets

    Maybe:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor stephenloky's Avatar
    Join Date
    07-10-2013
    Location
    Sao Paulo - Brazil
    MS-Off Ver
    Excel 2007
    Posts
    146

    Cool Re: How to create a macro button to clear muliple cells on multiple worksheets

    Do clear contents of specified cells, Just do
    Please Login or Register  to view this content.
    That's the easiest way on how to do it....Of course there's more optimized methods, but that's it.
    If you want a box to confirm...
    Please Login or Register  to view this content.
    "The quieter you become, the more you are able to hear"

    Any reputation (*) points appreciated.

    "If you know yourself but not the enemy, for every victory gained, you will suffer defeat."

  6. #6
    Valued Forum Contributor
    Join Date
    06-23-2010
    Location
    North West
    MS-Off Ver
    office 2010
    Posts
    355

    Re: How to create a macro button to clear muliple cells on multiple worksheets

    Very fast response indeed, I haven't had time to try any solutions yet but to quickly answer the questions.
    AB33 the message box should just appear just once after
    John H Davies -Thanks, looks good, Ill try it as soon as I canclicking, just in case it was clicked by mistake
    PCI sorry for the confusion. It should be C22 and C41

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to create a macro button to clear muliple cells on multiple worksheets

    There is a button on sheet information.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,085

    Re: How to create a macro button to clear muliple cells on multiple worksheets

    See next code
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by PCI; 07-02-2014 at 04:54 PM.

  9. #9
    Valued Forum Contributor
    Join Date
    06-23-2010
    Location
    North West
    MS-Off Ver
    office 2010
    Posts
    355

    Re: How to create a macro button to clear muliple cells on multiple worksheets

    Thank you to everyone who contributed to solving this problem, your help is valued and very much appreciated, the solutions provided work equally well, thanks again for your hard work

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro Button To Clear Certain Cells
    By mohannah in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-26-2014, 04:07 AM
  2. [SOLVED] create a 'button' to click to clear cells
    By OAKLEY in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-13-2014, 07:12 AM
  3. Macro Button To Clear Certain Cells
    By TroyDurham in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-28-2009, 03:33 AM
  4. Create a button to clear data in certain cells
    By headbanger51 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-07-2008, 03:18 AM
  5. [SOLVED] Create a button to Clear Cells
    By tamato43 in forum Excel General
    Replies: 3
    Last Post: 05-15-2005, 10:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1