Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 09-30-2015, 01:46 AM
macropod's Avatar
macropod macropod is offline Inserting a Merged Row after a certain text is found in a table Windows 7 64bit Inserting a Merged Row after a certain text is found in a table Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,536
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try something based on:
Code:
Sub Demo()
Dim i As Long, StrTxt As String
With ActiveDocument.Tables(1)
  For i = .Rows.Count To 1 Step -1
    If InStr(.Cell(i, 2).Range.Text, "Ensure S") = 1 Then
      StrTxt = Split(.Cell(i, 2).Range.Text, " ")(1)
      .Rows.Add BeforeRow:=.Rows(i)
      With .Rows(i)
        .Cells.Merge
        .Shading.BackgroundPatternColor = -603930625
        .Range.Style = wdStyleNormal
        .Range.Text = "Step " & StrTxt
      End With
    End If
  Next
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting a Merged Row after a certain text is found in a table Text position in merged table cells - word 2010 ellentk Word Tables 3 09-09-2015 03:33 PM
Inserting a Merged Row after a certain text is found in a table inserting wordwrap table causes paragraph break in text sodiumkpump Word Tables 1 08-05-2015 06:36 PM
Inserting a Merged Row after a certain text is found in a table Table will not allow sorting because "cells are merged". I can't find the merged cells. wendyloooo Word Tables 1 05-26-2015 01:19 PM
Inserting Images into a Table Cell without Moving the Text suzan Word 0 06-27-2014 05:20 AM
Inserting a Merged Row after a certain text is found in a table programmatically inserting hidden text into a Word 2010 table epid011 Word VBA 16 12-30-2013 11:29 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:52 AM.


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