Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-31-2022, 11:27 PM
gmayor's Avatar
gmayor gmayor is offline How can I use Word Vba to insert a blank row after rows with cells containing certain texts? Windows 10 How can I use Word Vba to insert a blank row after rows with cells containing certain texts? Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Assuming no merged cells
Code:
Sub Macro1()
Dim oTable As Table
Dim oRow As Row
Dim i As Integer, j As Integer
    For i = 1 To ActiveDocument.Tables.Count
        Set oTable = ActiveDocument.Tables(i)
        For j = oTable.Rows.Count To 1 Step -1
            Set oRow = oTable.Rows(j)
            If InStr(1, oRow.Range, "total") > 0 Then
                oRow.Range.Rows.Add
            End If
        Next j
    Next i
    Set oTable = Nothing
    Set oRow = Nothing
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to combine the texts of all cells in a column without line break. ericliu24 Word VBA 1 03-29-2022 05:28 PM
How can I use Word Vba to insert a blank row after rows with cells containing certain texts? Delete blank rows between the two rows that contain data beginner Excel Programming 5 12-26-2014 12:29 AM
How can I use Word Vba to insert a blank row after rows with cells containing certain texts? Search the text in 3rd cell by using texts in 2 cells Shinaj Excel Programming 1 05-09-2014 09:17 AM
How can I use Word Vba to insert a blank row after rows with cells containing certain texts? Unable to vertically center align texts in table cells? tinfanide Word 3 11-24-2013 06:37 AM
How can I use Word Vba to insert a blank row after rows with cells containing certain texts? How to organize and insert blank cells between a huge number of data? tareq Excel 12 09-29-2010 02:12 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:17 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