+ Reply to Thread
Results 1 to 4 of 4

ClearContents of Merged Cells

  1. #1
    Forum Contributor
    Join Date
    12-06-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    201

    ClearContents of Merged Cells

    How do I do a .ClearContents on merged cells from VBA? I need to programmatically delete values in merged cells but keep the formatting of the cells intact.

    I get an error "Runtime Error 1004: Cannot change part of a merged cell." if I use .ClearContents on a merged cell.

    Or do I just go for .Value = "" to delete whatever is in the cell?
    Last edited by Bezzie; 02-02-2015 at 11:06 AM.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: ClearContents of Merged Cells

    If A1:A3 is merged, try:
    Please Login or Register  to view this content.
    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.

  3. #3
    Forum Contributor
    Join Date
    12-06-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: ClearContents of Merged Cells

    Thanks Mumps1. I use .Cells in stead of .Range but the .MergeArea idea still works. The following did the trick.
    Please Login or Register  to view this content.

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: ClearContents of Merged Cells

    My pleasure.

+ 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. Replies: 0
    Last Post: 11-25-2014, 07:08 AM
  2. Mutually Exclusive Tick Marks (Merged Cells / ClearContents issue)
    By mjvoce in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-12-2013, 05:26 AM
  3. [SOLVED] How do I use a ClearContents on a merged cell
    By Turtleman10 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-07-2013, 01:13 PM
  4. [SOLVED] VB:ClearContents Error on Merged Cell - But I dont have Any Merged Cell
    By cychua in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-24-2013, 06:33 AM
  5. Replies: 1
    Last Post: 06-28-2012, 11:53 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