+ Reply to Thread
Results 1 to 17 of 17

Excel Cell button to Clear set Ranges

  1. #1
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Excel Cell button to Clear set Ranges

    Good Morning,

    I'm trying to use cells in dynamic column H to change certain values in other columns for that corresponding row only.

    I'm trying to use the following:

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Excel Cell button to Clear set Ranges

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Excel Cell button to Clear set Ranges

    Quote Originally Posted by mehmetcik View Post
    Please Login or Register  to view this content.
    Thank you, would you mind explaining the steps in your code?

  4. #4
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Excel Cell button to Clear set Ranges

    Getting "Endif without Block If" error.

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Excel Cell button to Clear set Ranges

    It's simple to delete the line of (End If) to remove the error
    It's working well after removing this line

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Excel Cell button to Clear set Ranges

    Try this :
    Please Login or Register  to view this content.

  7. #7
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Excel Cell button to Clear set Ranges

    Does this kind of code help? It will only fire if you double click between H1 and the last row that has data in column H.

    Please Login or Register  to view this content.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  8. #8
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Excel Cell button to Clear set Ranges

    Thanks,

    I'm not sure I understand the Range("A12,B2,C3") part.

  9. #9
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Excel Cell button to Clear set Ranges

    Quote Originally Posted by MarvinP View Post
    Does this kind of code help? It will only fire if you double click between H1 and the last row that has data in column H.

    Please Login or Register  to view this content.
    Thanks,

    How would I modfy this for a dynamic named range in column H called "ClearList"?

  10. #10
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Excel Cell button to Clear set Ranges

    Perhaps,

    Please Login or Register  to view this content.
    Let me explain how I do these types of problems. I really don't know what the VBA will look like if I select a Named Range and then ClearContents. The way I find out is to turn on the Macro Recorder and do the process manually. Then turn off the recording and look at the VBA code that is generated. I then copied and pasted it into the above. It looks like my keystroke actions produced the above two lines of code. I then copy and pasted these two lines of code into my code above.

    Does this solve your problem?
    Last edited by MarvinP; 12-12-2014 at 01:48 PM.

  11. #11
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Excel Cell button to Clear set Ranges

    May be like that :
    Please Login or Register  to view this content.

  12. #12
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Excel Cell button to Clear set Ranges

    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Excel Cell button to Clear set Ranges

    Quote Originally Posted by mehmetcik View Post
    Please Login or Register  to view this content.
    Thank you!

  14. #14
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Excel Cell button to Clear set Ranges

    Quote Originally Posted by YasserKhalil View Post
    May be like that :
    Please Login or Register  to view this content.
    Using
    Please Login or Register  to view this content.
    Gives me error "Method Range of Object Worksheet failed "

  15. #15
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Excel Cell button to Clear set Ranges

    Never mind I think it's fixed. Thanks for the help!

  16. #16
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Excel Cell button to Clear set Ranges

    You should have a named range (ClearList)
    Formulas Tab >> Name Manager >> Click New >> In the Name Field type ClearList >> In Refers To Field Type:
    Please Login or Register  to view this content.
    You can change the start point of the range

  17. #17
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Excel Cell button to Clear set Ranges

    Yep for some reason I changed the names of the ranges and they didn't save so when I was referring to "ClearList" it was actually named as something else. Thanks!

+ 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. [SOLVED] Clear 2 ranges of cell data when value is changed in primary drop down
    By ohlalayeah in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-02-2012, 11:17 AM
  2. [SOLVED] Clear button, add warning dialogue box that asks: Are you sure you want to clear?
    By nenadmail in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-21-2012, 02:41 PM
  3. macro to clear contents of two ranges if cell is blank
    By fisher-price in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-30-2011, 10:39 PM
  4. [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
  5. Clear cell contents with a button
    By KFC / A&W Boy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-07-2005, 06:06 AM

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