+ Reply to Thread
Results 1 to 4 of 4

Clear Command Button

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-13-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    464

    Clear Command Button

    I want to add a button to a sheet that, when clicked, will clear the values from Cells A5:A26. Can anyone assist?

  2. #2
    Forum Contributor
    Join Date
    11-13-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    464

    Re: Clear Command Button

    Found it...

    Private Sub CommandButton1_Click()
    Dim resp
    
    resp = MsgBox("Are you sure?", vbOKCancel)
    If resp = vbOK Then
        ActiveSheet.Range("A1").Value = Null
    End If
    End Sub

    Google rocks

  3. #3
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Clear Command Button

    Hi,

    Like this???


  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,714

    Re: Clear Command Button

    Try this:

    Sub foo()
    Dim rng As Range
    Set rng = Range("A5:A26")
    rng.ClearContents
    End Sub
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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. Clear command button
    By slmi1313 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-27-2012, 06:01 AM
  2. Command Button - Clear
    By grkchakri in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-05-2012, 12:39 AM
  3. Command Button to clear checkbox
    By zplugger in forum Excel General
    Replies: 2
    Last Post: 06-26-2011, 09:36 AM
  4. Command Button To Save & Clear
    By Mooseman60 in forum Access Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2011, 07:38 AM
  5. [SOLVED] How do i clear a cell using a command button?
    By Mariann in forum Excel General
    Replies: 1
    Last Post: 03-30-2006, 04:15 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