+ Reply to Thread
Results 1 to 13 of 13

unable to ClearContents on a Merged Cell using VBA

  1. #1
    Registered User
    Join Date
    02-08-2016
    Location
    Sydney, Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2010
    Posts
    8

    unable to ClearContents on a Merged Cell using VBA

    I have the following VBA Code to clear contents on 3 Cells 2 of which a merged cells:

    Please Login or Register  to view this content.
    I don't have any issues with the 1st of the 3, that one just time stamps a cell and clears it because that one doesn't involve a merged cell.
    The bottom 2 are my issues. I need it so that I enter a name into B7 that then date stamps B8 and adds a naming convention for users to save the file with under cell J8
    Cell B8 is merged as following: B8:H8
    Cell J8 is merged as following: J8:Z8

    I am very new to VBA and only understand very little of its jargon. I have basically pieced this together from other threads I have seen and altered it for my own use.
    Appreciate any help I can get.
    Cheers

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: unable to ClearContents on a Merged Cell using VBA

    You may use:
    Please Login or Register  to view this content.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  3. #3
    Registered User
    Join Date
    02-08-2016
    Location
    Sydney, Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2010
    Posts
    8

    Re: unable to ClearContents on a Merged Cell using VBA

    Thanks Izandol, but that hasn't seemed to fix the issue, it is still not clearing the merged cells.

    Quote Originally Posted by Izandol View Post
    You may use:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-08-2016
    Location
    Sydney, Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2010
    Posts
    8

    Re: unable to ClearContents on a Merged Cell using VBA

    One thing that I just noticed in my spreadsheet is, that when I manually clear contents in cell B7 it isn't clearing the contents on my other 2 cells, HOWEVER, if I then double click to enter into cell B7 and then exit out of the blank cell, it does clear the contents of the 2 merged cells.
    So is there something wrong with part of my code?

  5. #5
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: unable to ClearContents on a Merged Cell using VBA

    Please post workbook showing this.

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: unable to ClearContents on a Merged Cell using VBA

    Hi Leggs

    Not tested...try this for the first instance...
    Please Login or Register  to view this content.
    and this for the second instance...
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  7. #7
    Registered User
    Join Date
    02-08-2016
    Location
    Sydney, Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2010
    Posts
    8

    Re: unable to ClearContents on a Merged Cell using VBA

    test.xlsm

    Thanks jaslake
    but that also didn't work.

    I have attached a secondary workbook that has the same properties as the original one that I need this to work for. Unfortunately I cannot provide you with the original, not to mention that it has data in it making the file size upwards of 20mb.
    Hope this helps.
    Cheers

  8. #8
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: unable to ClearContents on a Merged Cell using VBA

    Hi Leggs11,
    maybe so
    in B8
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    in J8
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    02-08-2016
    Location
    Sydney, Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2010
    Posts
    8

    Re: unable to ClearContents on a Merged Cell using VBA

    Thanks nilem,
    Formula's I have no trouble with, I can easily have the formula's in there, however I need the users to be able to double click in the cell and copy and paste from there, copying and pasting from outside the cell doesn't work for what we need, and if I have a formula then when double clicked it just enters into the formula code, unless I have the cell as 'hidden' and then when double clicking it deletes the text in the cell.

  10. #10
    Registered User
    Join Date
    02-08-2016
    Location
    Sydney, Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2010
    Posts
    8

    Re: unable to ClearContents on a Merged Cell using VBA

    Thanks nilem,
    Formula's I have no trouble with, I can easily have the formula's in there, however I need the users to be able to double click in the cell and copy and paste from there, copying and pasting from outside the cell doesn't work for what we need, and if I have a formula then when double clicked it just enters into the formula code, unless I have the cell as 'hidden' and then when double clicking it deletes the text in the cell.

  11. #11
    Registered User
    Join Date
    02-08-2016
    Location
    Sydney, Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2010
    Posts
    8

    Re: unable to ClearContents on a Merged Cell using VBA

    I have discovered that my issue is now only with the Cell "B7", I have adjusted the code and it can now clear the contents of merged cells B8:H8 and J8:Z8 if cell B7 is NOT merged. But it will not clear the contents of the 2 cells while it is merged as B7:H7.

    the code is currently:
    Please Login or Register  to view this content.

  12. #12
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: unable to ClearContents on a Merged Cell using VBA

    You may try this:
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    02-08-2016
    Location
    Sydney, Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2010
    Posts
    8

    Re: unable to ClearContents on a Merged Cell using VBA

    YES!! thank you so much Izandol!!, that has fixed it perfectly.
    and I can now publish my spreadsheet for use

    Thanks for everyones help on my issue.
    Cheers.

+ 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] Unable to sort in Excel because of merged cells
    By Bruce in forum Excel General
    Replies: 7
    Last Post: 05-03-2016, 11:09 PM
  2. Unable to create chart because of merged cells
    By sabha in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-26-2016, 06:59 AM
  3. Unable to =Count() Cells that were once Merged
    By JoshDR in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-27-2015, 03:34 PM
  4. [SOLVED] ClearContents of Merged Cells
    By Bezzie in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-02-2015, 11:26 AM
  5. 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
  6. [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
  7. [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

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