+ Reply to Thread
Results 1 to 6 of 6

Thread: How do I determine if Row contains merged cells?

  1. #1
    Forum Contributor sauerj's Avatar
    Join Date
    11-11-2009
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2003
    Posts
    116

    Question How do I determine if Row contains merged cells?

    NOTE TO MANAGER: If this question gets resolved, then my previous question
    "How do I determine Table Column Index Number?" should be deleted!!!

    If I select the LAST ROW of a table, how can I determine if it contains MERGED CELLS?
    Thanks for your help!
    Last edited by sauerj; 09-17-2010 at 09:23 AM.

  2. #2
    Forum Guru
    Join Date
    10-28-2008
    Location
    Not here anymore
    MS-Off Ver
    irrelevant
    Posts
    10,152

    Re: How do I determine if Row contains merged cells?

    You may want to use a different way of defining your range for the last row, but once you have it selected, you could use something along these lines:

    Sub test()
    Dim cel As Range
    Range("14:14").Select
    For Each cel In Selection
        Set ma = cel.MergeArea
        If ma.Address <> cel.Address Then
            HasMergedCells = True
            Exit For
        End If
    Next
    End Sub

  3. #3
    Forum Guru
    Join Date
    10-28-2008
    Location
    Not here anymore
    MS-Off Ver
    irrelevant
    Posts
    10,152

    Re: How do I determine if Row contains merged cells?

    Scratch that. I just realised you asked in the Word forum, not Excel.

  4. #4
    Forum Contributor sauerj's Avatar
    Join Date
    11-11-2009
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2003
    Posts
    116

    Re: How do I determine if Row contains merged cells?

    Thanks for trying. Not a lot of help out there for Word when you get a little deeper than the beginner level (ugh!).

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    2003 & 2007 & 2010
    Posts
    11,357

    Re: How do I determine if Row contains merged cells?

    I only have Word 2007 but this seems to work.

        Dim tblTemp As Table
        
        Set tblTemp = ActiveDocument.Tables(1)
        If tblTemp.Columns.Count <> tblTemp.Rows(tblTemp.Rows.Count).Cells.Count Then
            MsgBox "Row has merged cells in last row", vbInformation
        End If
    Cheers
    Andy
    www.andypope.info

  6. #6
    Forum Contributor sauerj's Avatar
    Join Date
    11-11-2009
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2003
    Posts
    116

    Smile Re: How do I determine if Row contains merged cells?

    Wow! Your good! I love it when the answer is simple & clean! ... SOLVED and merit given!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0