View Single Post
 
Old 10-04-2013, 08:34 AM
hummus_it hummus_it is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Oct 2013
Posts: 3
hummus_it is on a distinguished road
Default

That's pretty much perfect. Is there a way to have the loop reset at rows which contain a certain string?

For example, have something like:
Code:
 For i = 1 To .Rows.Count
      'Restore borders to every 2nd row
      If i Mod 2 = 0 and rowdoesnotcontain Then
        With .Rows(i).Cells
          .Borders(wdBorderTop).LineStyle = wdLineStyleSingle
          .Borders(wdBorderLeft).LineStyle = wdLineStyleSingle
          .Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
          .Borders(wdBorderRight).LineStyle = wdLineStyleSingle
          .Borders(wdBorderHorizontal).LineStyle = wdLineStyleSingle
          .Borders(wdBorderVertical).LineStyle = wdLineStyleSingle
          else 
         
        With .Rows(i).Cells
          .Borders(wdBorderTop).LineStyle = wdLineStyleSingle
          .Borders(wdBorderLeft).LineStyle = wdLineStyleSingle
          .Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
          .Borders(wdBorderRight).LineStyle = wdLineStyleSingle
          .Borders(wdBorderHorizontal).LineStyle = wdLineStyleSingle
          .Borders(wdBorderVertical).LineStyle = wdLineStyleSingle
          
        End With
      End If
    Next
  End With
End With
End Sub
Reply With Quote