View Single Post
 
Old 08-19-2019, 04:22 PM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

So your table has 10 columns odd have numbers with "$" and even are empty. Yes? Try:
Code:
Sub Macro1()
Dim lngIndex As Integer
Dim oTbl As Table
Dim oRng As Range
Dim strText As String
Dim lngCol As Long
Dim varVal
  strText = InputBox("Enter text to move cell")
  Application.ScreenUpdating = False
  For Each oTbl In ActiveDocument.Tables
    For lngCol = 1 To oTbl.Columns.Count - 1 Step 2
      For lngIndex = 1 To oTbl.Rows.Count
        Set oRng = oTbl.Cell(lngIndex, lngCol).Range
        oRng.End = oRng.End - 1
        varVal = Split(oRng.Text, strText)
        If UBound(varVal) = 1 Then
          oRng.Text = Trim(varVal(1))
          oRng.Cells(1).Next.Range.Text = strText
        End If
      Next lngIndex
      DoEvents
    Next lngCol
  Next oTbl
  Application.ScreenUpdating = True
  MsgBox "Tables processed"
lbl_Exit:
  Set oTbl = Nothing
  Set oRng = Nothing
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote