Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Jul 2003
    Location
    Portland, Oregon, USA
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Shift Table Cells (2002)

    I have a table consisting of 3 columns and 8 rows with names and addresses in each cell. If I delete a cell in the middle of my table, how do shift all cells to the previous cell so I don't have an empty cell in the middle of my table? <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Shift Table Cells (2002)

    Are you deleting the cell? or the contents of the cell? (I don't know any way to delete a cell in the middle of a word table, except by merging it with another one.)

    Are you doing this from VBA? or using the keyboard? or the mouse?

    StuartR

  3. #3
    3 Star Lounger
    Join Date
    Apr 2004
    Location
    Boston, Massachusetts, USA
    Posts
    389
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Shift Table Cells (2002)

    With the cell selected, when you go to Table -> Delete -> Cells, you should be prompted to choose how to accommodate the change. In your case, choose "Shift Cells Left"

    HTH,

  4. #4
    Star Lounger
    Join Date
    Jan 2001
    Location
    U.S. - East Coast
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Shift Table Cells (2002)

    Here's a quick macro you can use to delete selected cells, shift remaining cells to the left, and pad the row with empty cells. Please note that this macro is designed to handle only one row of selected cells and can be substantially improved (handle multiple rows, etc.).

    <pre>Sub CellWacker()

    'Remove selected cells, shift remaining cells (if any) to the left,
    'pad out the row with empty cells.

    Dim intCellCount As Integer
    Dim intCounter As Integer
    Dim rngOriginalSelection As Range
    Dim rngDeletedCells As Range


    Set rngOriginalSelection = Selection.Range
    Set rngDeletedCells = Selection.Range

    '*** Get the number of cells to be removed.
    intCellCount = rngDeletedCells.Cells.Count

    '*** Wack the cells.
    rngDeletedCells.Cells.Delete ShiftCells:=wdDeleteCellsShiftLeft

    '*** Get the range of the affected row.
    Set rngDeletedCells = rngDeletedCells.Rows(1).Range

    'Move off end of row mark.
    rngDeletedCells.MoveEnd wdCharacter, -1

    'Replace deleted cells with empty cells.
    For intCounter = 1 To intCellCount
    rngDeletedCells.Cells.Add
    Next intCounter

    End Sub
    </pre>


  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Shift Table Cells (2002)

    If you mean you want to delete an entire column, click in a cell in that column and use Table>Delete>Columns to remove it. Depending on your table settings, the other columns might simply slide over, or they might resize themselves.

    If you mean you want to delete an entire row, click in a cell in that row and use Table>Delete>Rows.

    If you want to move content, Word is reasonably intelligent about cut and paste. So if you select and cut a group of cells, then reposition on the blank cell and paste, it usually fills in the way you would expect. Sometimes you need to paste to an identically shaped selection. (Okay, maybe Word isn't as predictable as I like to think.)

    Finally, if you want to delete a single cell so that you don't have a consistent number of rows or columns in your table, don't do it! Word tables can get corrupted, and these sorts of inconsistencies might hasten that end.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •