View Single Post
 
Old 01-08-2014, 02:00 PM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,598
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

It can be used repeatedly as long as you close each instance of

With ActiveDocument.Tables(#) ...

with an

End With

statement

Or you might want to run the same code on some multiple tables:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim lngIndex As Long
 For lngIndex = 1 To ActiveDocument.Tables.Count
  Select Case lngIndex
    Case 1 To 4
      With ActiveDocument.Tables(lngIndex)
        .Cell(1, 1).Range.Text = "A"
      End With
    Case 5, 6
      With ActiveDocument.Tables(lngIndex)
        .Cell(1, 1).Range.Text = "B"
      End With
    Case 7
      With ActiveDocument.Tables(lngIndex)
        .Cell(1, 1).Range.Text = "C"
      End With
  End Select
Next
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote