skaz
07-22-2016, 03:35 PM
Hi. I have a number of documents that contain varying numbers of tables. The tables are currently in the wrong location and need to be moved down 13 lines from their current position.
I'd like to create a macro that will find each table and move it. I've was able to create a macro that moves the first table but I'm not sure how to fix all tables.
The code I have is:
Dim myCells As Range
With ActiveDocument
Set myCells = .Range(start:=.Tables(1).Cell(1, 1).Range.start, _
End:=.Tables(1).Cell(5, 2).Range.End)
myCells.Select
Selection.Cut
Selection.MoveDown Unit:=wdLine, Count:=13
Selection.Paste
End With
I tried adding a "For Each Table in Active Document" line at the top, but that had unwanted results (too confusing to describe).
Can anyone suggest a fix for this?
Thanks in advance!
I'd like to create a macro that will find each table and move it. I've was able to create a macro that moves the first table but I'm not sure how to fix all tables.
The code I have is:
Dim myCells As Range
With ActiveDocument
Set myCells = .Range(start:=.Tables(1).Cell(1, 1).Range.start, _
End:=.Tables(1).Cell(5, 2).Range.End)
myCells.Select
Selection.Cut
Selection.MoveDown Unit:=wdLine, Count:=13
Selection.Paste
End With
I tried adding a "For Each Table in Active Document" line at the top, but that had unwanted results (too confusing to describe).
Can anyone suggest a fix for this?
Thanks in advance!