![]() |
#6
|
||||
|
||||
![]()
The simplest approach would be to test whether the rows preceding the 'Ensure SXXXXX' content have more than one cell and, if not, skip over them, this:
Code:
Sub Demo() Dim i As Long, StrTxt As String With ActiveDocument.Tables(1) For i = .Rows.Count To 2 Step -1 If .Rows(i - 1).Cells.Count > 1 Then 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 Else i = i - 1 End If Next End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
ellentk | Word Tables | 3 | 09-09-2015 03:33 PM |
![]() |
sodiumkpump | Word Tables | 1 | 08-05-2015 06:36 PM |
![]() |
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 |
![]() |
epid011 | Word VBA | 16 | 12-30-2013 11:29 AM |