Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 09-08-2019, 09:33 AM
gmaxey gmaxey is offline How to merge empty cells before "ok" with a for loop Windows 10 How to merge empty cells before "ok" with a for loop Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

If the table is a single column table as your example indicates then something like this:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oCell As Cell
  With ActiveDocument.Tables(1)
    Set oCell = .Cell(1, 1)
    Do
      If oCell.RowIndex = .Rows.Count Then Exit Do
      Do While Len(oCell.Range.Text) = 2 And Len(oCell.Next.Range.Text) = 2
        If oCell.RowIndex = .Rows.Count Then Exit Do
        oCell.Merge oCell.Next
      Loop
      If oCell.RowIndex = .Rows.Count Then Exit Do
      Set oCell = oCell.Next
    Loop
  End With
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to merge empty cells before "ok" with a for loop Mail Merge Using Rules "IF" to add additional Text Based On Merge Field Content Alfred Mail Merge 2 05-23-2017 10:59 PM
In Excel 2007-After Selecting Visibe Cells-How do I "Copy to Visible cells" Only mag Excel 0 10-28-2012 08:04 PM
'Linking' entered information to other "cells" from an original "cell" in MS Word Wade Word 6 09-03-2012 05:22 PM
How to merge empty cells before "ok" with a for loop Is the a way to delete the "empty" paragraphs? Jamal NUMAN Word 3 07-27-2011 04:19 AM
How to merge empty cells before "ok" with a for loop How to choose a "List" for certain "Heading" from "Modify" tool? Jamal NUMAN Word 2 07-03-2011 03:11 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:09 AM.


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