+ Reply to Thread
Results 1 to 7 of 7

Clear contents of unlocked cells, but some of them are merged

  1. #1
    Registered User
    Join Date
    09-29-2024
    Location
    Texas
    MS-Off Ver
    2024
    Posts
    11

    Clear contents of unlocked cells, but some of them are merged

    New to the forum. I am trying to clear data on specific sheets & specific cells in my excel workbook. I am currently using the code below because some of the cells I need cleared are merged and it works great so far but it clears all the unprotected cells on the entire workbook. The clearcontents code would not work for me because of my merged cells. How can I edit this code to only clear the unprotected cells on specific sheets? I have one sheet I need to leave unprotected but I do not want this data cleared.
    Please Login or Register  to view this content.
    Administrator's note: Please take the time to review our rules. There aren't many, and they are all important. Our guidelines recommend code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Last edited by 6StringJazzer; 09-29-2024 at 06:08 PM. Reason: please use code tags; better titles please

  2. #2
    Registered User
    Join Date
    10-21-2022
    Location
    Fort Worth, TX USA
    MS-Off Ver
    Microsoft® Excel® for Microsoft 365 MSO (Version 2411 Build 16.0.18227.20082) 64-bit
    Posts
    41

    Re: Clear contents of unlocked cells, but some of them are merged

    Most people here would tell you to avoid using merged cells. They cause lots of problems. I'll look for 6Stringjazzer's post that lists quite a lot of them for you.
    "Oh Well..Whatever..Nevermind" - Kurt Cobain

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,024

    Re: Clear contents of unlocked cells, but some of them are merged

    It would be easier to help if we could see how your data is organized and test possible solutions if you could attach a copy of your file. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary). See the yellow banner at the top of this page for instructions to attach a file.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,966

    Re: Clear contents of unlocked cells, but some of them are merged

    Quote Originally Posted by MattyT92 View Post
    I am trying to clear data on specific sheets & specific cells
    Which sheets and which cells? Same cells on each sheet, or different cells for different sheets?
    Everyone who confuses correlation and causation ends up dead.

  5. #5
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,929

    Re: Clear contents of unlocked cells, but some of them are merged

    Quote Originally Posted by MattyT92
    I have one sheet I need to leave unprotected
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    09-29-2024
    Location
    Texas
    MS-Off Ver
    2024
    Posts
    11

    Re: Clear contents of unlocked cells, but some of them are merged

    Quote Originally Posted by ByteMarks View Post
    Please Login or Register  to view this content.
    Thanks for the reply! I tried your modification but it still cleared the sheet I skipped.

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,966

    Re: Clear contents of unlocked cells, but some of them are merged

    Bear in mind that the name test is case-sensitive as written. To avoid that you could use something like:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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