+ Reply to Thread
Results 1 to 10 of 10

macro for clearing cells

  1. #1
    Forum Contributor
    Join Date
    04-18-2013
    Location
    utah
    MS-Off Ver
    2010
    Posts
    668

    macro for clearing cells

    I am looking for a macro to attach to a button that will clear cells. the problem i have is i protect the whole sheet and only one a certain cells to unprotect and clear.

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: macro for clearing cells

    Which cells would you like to unprotect and clear?
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Contributor
    Join Date
    04-18-2013
    Location
    utah
    MS-Off Ver
    2010
    Posts
    668

    Re: macro for clearing cells

    A5:c31,h5:j31,o5:q31,v5:x31, a38:c64, h38:j64

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: macro for clearing cells

    Please Login or Register  to view this content.
    change password to your actual password. If there isn't a password then delete it.

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: macro for clearing cells

    Hi, superchew,

    you could use the volatile setting of protecting the worksheet with the parameter UserInterfaceOnly:=True to allow macros to run without unprotecting the sheet.

    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  6. #6
    Forum Contributor
    Join Date
    04-18-2013
    Location
    utah
    MS-Off Ver
    2010
    Posts
    668

    Re: macro for clearing cells

    Test 7.xlsm

    This is telling me it can't change part of a merged cell.. I have attached a copy of the form

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: macro for clearing cells

    Hi, superchew,

    it would have been an excellent idea to mention MergedCells in the opening post - I never would have answered to this thread then. This doesn´t mean I can´t handle MergedCells in VBA but I´m convinced you would do better when you avoid using them.

    Answer to the error message: refer to the complete ranges of the merged cells as well, not only the first cell(s).

    Ciao,
    Holger

  8. #8
    Forum Contributor
    Join Date
    04-18-2013
    Location
    utah
    MS-Off Ver
    2010
    Posts
    668

    Re: macro for clearing cells

    sorry newbie didn't know it mattered.. Thank.

  9. #9
    Forum Contributor
    Join Date
    04-18-2013
    Location
    utah
    MS-Off Ver
    2010
    Posts
    668

    Re: macro for clearing cells

    works great thanks.

  10. #10
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: macro for clearing cells

    Hi, superchew,

    if your problem has been solved please mark the thread as Solved via Thread Tools above the first post of this thread. Thank you.

    Ciao,
    Holger

+ 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] How to adapt winnons macro for clearing cells to work when sheet is protected
    By nje in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 02-06-2013, 01:03 PM
  2. Clearing cells using VBA
    By StuntMonkeh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-14-2008, 11:36 AM
  3. Clearing "zero" from cells with a Macro
    By notaclone in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2007, 08:57 PM
  4. Clearing Cells
    By Andyd74 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2006, 12:35 PM
  5. Clearing Cells
    By mully in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 05-19-2005, 04: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