+ Reply to Thread
Results 1 to 4 of 4

Create a button to Clear Cells

  1. #1
    tamato43
    Guest

    Create a button to Clear Cells

    Hello,

    Can anyone help me set up a button and macro to clear cells where data is
    entered.

    Lets say, I'm looking to clear Cells A1,B1,C1 and A3, B3, C3.

    Remember I would still need a button that would then prompt the Macro.

  2. #2
    Naz
    Guest

    RE: Create a button to Clear Cells

    1) Record yourself clearing the cells, as follows
    Tools
    Macro
    Record New Macro
    Select the cells
    Press delete
    Stop recording the macro.

    2) Create button as follows
    View
    Toolbars
    Form
    From the forms bar select the button icon
    Drag out a rectangular button
    Once you have dragged it out a pop up will appear asking you to assign
    a macro.
    Select the macro you recorded in step 1)

    Finished.
    Any probs. Post back


    --

    _______________________
    Naz,
    London


    "tamato43" wrote:

    > Hello,
    >
    > Can anyone help me set up a button and macro to clear cells where data is
    > entered.
    >
    > Lets say, I'm looking to clear Cells A1,B1,C1 and A3, B3, C3.
    >
    > Remember I would still need a button that would then prompt the Macro.


  3. #3
    Franz Verga
    Guest

    Re: Create a button to Clear Cells

    "tamato43" <[email protected]>ha scritto nel messaggio
    [email protected]

    > Hello,
    >
    > Can anyone help me set up a button and macro to clear cells where
    > data is entered.


    If you don't need to use it in a macro, but in your regular use of Excel,
    you can simply customize your toolbar to add the buttons you need. For
    Example, right click on a toolbar, choose Customize, from the left colum
    choose Edit and then from the right you can choose the Clear Conten or the
    CLear Format button and you can drag & drop it on your favorite toolbar...


    --
    Hoping to be helpful...

    Regards

    Franz Verga

    ----------------------------------------------------------------------------------------
    To reply translate from italian InVento (no capital letters)
    ----------------------------------------------------------------------------------------



  4. #4
    David McRitchie
    Guest

    Re: Create a button to Clear Cells

    The newsgroup for macros is excel.programming
    Sorry didn't look very carefully, as I see that question was
    answered; however, this is a bit different.

    If those are the ONLY cells you want to clear, then i presume this is only
    for one worksheet. So you could create a shape on the worksheet
    itself and assign the macro to it by right-clicking on the shape.

    Here is a macro that is invoked by a double click event on the
    worksheet. Install to the worksheet by right click on sheet tab, view code.

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Range("A1,B1,C1 , A3, B3, C3").ClearContents
    End Sub

    If you want a macro to assign to a shape or to a button

    Sub Clear_a1b1c1a3b3c3()
    Range("A1,B1,C1 , A3, B3, C3").ClearContents
    End Sub

    to create a shape or a toolbutton see
    http://www.mvps.org/dmcritchie/excel/toolbars.htm

    If you want something along the lines of removing constants from a selection

    on error resume next
    Selection.SpecialCells(xlConstants).ClearContents
    on error goto 0

    ---
    HTH,
    David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
    My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
    Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

    "tamato43" <[email protected]> wrote in message news:[email protected]...
    > Hello,
    >
    > Can anyone help me set up a button and macro to clear cells where data is
    > entered.
    >
    > Lets say, I'm looking to clear Cells A1,B1,C1 and A3, B3, C3.
    >
    > Remember I would still need a button that would then prompt the Macro.





+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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