+ Reply to Thread
Results 1 to 4 of 4

Error trying to loop through merged cells in a range?

  1. #1
    Registered User
    Join Date
    05-31-2019
    Location
    Shelbyville, IN
    MS-Off Ver
    2016
    Posts
    24

    Error trying to loop through merged cells in a range?

    I have an excel form that has lots of merged cells. I cannot unmerge the cells due to the nature of the form. What I want to do is loop through the merged cells in column A (see image below). If that cell contains data but the adjacent cells in column B or Column C do not then I want to exit sub. Also, if everything is OK and all the cells have data then I want to continue on with different code. I'm having an issue that because the cells are merged, even if the cells all contain data like they are supposed to it is treating it as though they do not have data. Below is the Code and an image from my workbook. I also tried to attach a sample WB but not sure if it worked. I tried adding ".mergearea" to my X variable but that did not work either. I appreciate any help on this.

    Please Login or Register  to view this content.
    Capture.JPG
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Error trying to loop through merged cells in a range?

    You can't either loop thorough merged cells, or if you do, you get a funny result. Before each cell unmerge it and merge it again.

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,498

    Re: Error trying to loop through merged cells in a range?

    What automatic code is in your attachment? If there is, disable it.
    Unable to open your workbook.

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,498

    Re: Error trying to loop through merged cells in a range?

    Please Login or Register  to view this content.
    Re: "I cannot unmerge the cells due to the nature of the form"
    A re-design of the form is required. Might take some time but eliminates future problems.
    Do a web search on why not to use "Merge & Center" in Excel. You'll be surprised at how many hits you'll get.

+ 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: 2
    Last Post: 01-24-2020, 12:10 PM
  2. Merged cell error on copy/paste, but no merged cells
    By OmniBlue in forum Excel General
    Replies: 3
    Last Post: 07-15-2019, 02:15 PM
  3. [SOLVED] Clear merged and non-merged cells in named range.
    By IMM Tech in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-20-2018, 12:37 PM
  4. Replies: 1
    Last Post: 10-22-2016, 04:27 AM
  5. Problems with loop and cells merged
    By sylvain133 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2013, 06:03 AM
  6. [SOLVED] nested loop for copying range: error no cells were found
    By Edejager in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-09-2013, 08:52 AM
  7. Error: Cannot change the part of merged cell - When trying to lock cells in range
    By Ranjani in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-09-2009, 12:03 PM

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