Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-27-2020, 01:32 AM
bpike bpike is offline Splitting Tables containing Merged Cells Windows 10 Splitting Tables containing Merged Cells Office 2019
Novice
Splitting Tables containing Merged Cells
 
Join Date: Oct 2020
Posts: 8
bpike is on a distinguished road
Default Splitting Tables containing Merged Cells

Hi all,



I'm hoping someone can help me with splitting tables that contain merged cells?

My macro works fine in a regular table, however, if there are any merged cells present I receive a Run-time error '-2147024808 (80070057)': Object has been deleted.

My code is as follows:

Code:
Sub SplitTable()

Dim oTbl As Word.Table, oRow As Row, oCell As Cell


For Each oTbl In ThisDocument.Tables
      
    n = 1
        Do While n > 0
        For Each oCell In oTbl.Range.Cells
        If oCell.Range = "Tree Number" & Chr(13) & Chr(7) Then n = oCell.RowIndex
        Next
        If n = 1 Then Exit Do
        oTbl.Split (n)
        n = 1
     
        Loop

Next oTbl

End Sub


Any workaround will be much appreciated.

Last edited by macropod; 10-27-2020 at 02:34 AM. Reason: Added code tags
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding Tables with Vertically Merged Cells T-Belle Word VBA 10 07-19-2020 07:09 PM
Splitting Tables containing Merged Cells Format tables with vertically merged cells jeffreybrown Word VBA 2 01-16-2019 03:23 PM
VBA color of visible gridlines of tables word (with some merged cells in first rows) Alvaro.passi Word VBA 0 07-18-2017 09:11 AM
Splitting Tables containing Merged Cells Overcome issues in tables with vertically merged cells rocky2 Word VBA 12 12-22-2016 03:03 AM
Combining 2 tables into 1 and use Table2's column widths (hoping for workaround dealing merged cells CodingGuruInTraining Word VBA 24 10-07-2015 07:48 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:25 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft