dcsimg
Results 1 to 2 of 2

Thread: Need a clear button

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2019
    Posts
    2

    Need a clear button

    Hi all:
    Can I get some help building a VB button that clears the data in certain cells on an Excel Spreadsheet when it is clicked on. I don't want to clear the whole sheet. Just certain designated cells.
    Any advice would be welcome.

  2. #2
    New Member Zuse's Avatar
    Join Date
    Oct 2019
    Posts
    9

    Re: Need a clear button

    This sub will accomplish the clearing of specific cells. You can change the range and sheet name to match your data
    Code:
    Sub ClearData()
        Sheets("SheetName").Range("A2:E100").ClearContents
    End Sub
    Then create a button and link it to the ClearData macro. Anytime the button is pressed, it will clear the range.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width