Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-26-2014, 07:23 AM
Cosmo Cosmo is offline Complex table issues - cells shift Windows Vista Complex table issues - cells shift Office 2007
Competent Performer
Complex table issues - cells shift
 
Join Date: Mar 2012
Posts: 240
Cosmo is on a distinguished road
Default Complex table issues - cells shift

I have to create complex forms in Word, which can be very complex at times, and I have constant problems with creating them as tables, where the table becomes as best as I can describe 'unstable' - once I get to a point editing the cells, suddenly the table rows/cells will shift on their own. Usually when this happens, it happens when I am either splitting a row/cell or if I am moving the cell's boundary. Once it happens, any other edits (including to cells which were editable previously without any problems) will compound the problem, and shift the rows/cells further. Even trying to fix the problem by adjusting the rows which are out of alignment only causes the table rows to shift more. Attached is an example:




I have not found out what is causing this issue, but it almost always seems to happen after I have spent hours setting up, and usually when I'm working on the last few rows. I have tried deleting the last few rows and recreating them, but the problem does not go away

The above table is on a page set to 2 columns, and the table spans both columns (I cannot use 2 separate tables, since tabbing from the last cell in one table will not go to the second table, but will create a new row in the first table).

If anyone can tell me why this is happening, and more importantly, how to either prevent it from happening, or fix it when it does happen, I would greatly appreciate it. Please let me know if there is any information about the table settings I can provide helpful in diagnosing this problem.
Reply With Quote
  #2  
Old 06-26-2014, 03:36 PM
macropod's Avatar
macropod macropod is offline Complex table issues - cells shift Windows 7 32bit Complex table issues - cells shift Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

When doing complex table editing I sometimes find it useful to split the table just above & below where I'm making the edits. Otherwise, cell splitting, moving cell borders and the like can have unwanted effects on other rows. Once the row(s) in question have been edited, re-joining the table is as simple as deleting the paragraph breaks inserted by the split process.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 06-27-2014, 05:36 AM
Cosmo Cosmo is offline Complex table issues - cells shift Windows Vista Complex table issues - cells shift Office 2007
Competent Performer
Complex table issues - cells shift
 
Join Date: Mar 2012
Posts: 240
Cosmo is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
When doing complex table editing I sometimes find it useful to split the table just above & below where I'm making the edits. Otherwise, cell splitting, moving cell borders and the like can have unwanted effects on other rows. Once the row(s) in question have been edited, re-joining the table is as simple as deleting the paragraph breaks inserted by the split process.
Thanks for the tip, I'm trying that now, and having a few issues.

So, when I first split the table at the point where I was having the issues, the rows at the split shift as they were before, so I'm trying to see if I can add new rows (or copy existing rows) to replace the ones that are causing the issues. Don't know yet if that is going to work.

Also, how do you delete the paragraph break between tables? I can never seem to do so; the only way I have been able to do this is to add a row to the top of the table after the break, and select both the break and the new row to delete.

I did notice something that may be a hint to what's going on, or maybe how to notice when the issue might be occurring. When I viewed the table in Outline view, the table looks like more of a mess than it does in the print view (rows that are ok in the print view are shifted in outline view). Attached is what the same table posted before looks like in Outline view:
Reply With Quote
  #4  
Old 06-27-2014, 05:50 AM
macropod's Avatar
macropod macropod is offline Complex table issues - cells shift Windows 7 32bit Complex table issues - cells shift Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Your image suggests you have a table that's been composed on rows copied/pasted from other tables with different alignments. Either that or you have some serious table corruption going on.

Assuming it's the latter, corrupt tables can often be 'repaired' by converting the tables to text and back again or by cutting & pasting them to another document, saving that document in RTF format, closing the document then re-opening it and copying back to your original document.

If it's the former, you'll need to:
• turn off any 'around' text wrapping;
• split the table wherever there's a disjunction of the alignments; and
• make sure all the split tables have the same alignment, non-wrap settings and indents.
Once you've done that, you can re-join them. To delete the intervening paragraphs between the tables so you can re-join them is no more difficult than selecting them and pressing Delete.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 06-27-2014, 06:20 AM
Cosmo Cosmo is offline Complex table issues - cells shift Windows Vista Complex table issues - cells shift Office 2007
Competent Performer
Complex table issues - cells shift
 
Join Date: Mar 2012
Posts: 240
Cosmo is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Your image suggests you have a table that's been composed on rows copied/pasted from other tables with different alignments. Either that or you have some serious table corruption going on.

Assuming it's the latter, corrupt tables can often be 'repaired' by converting the tables to text and back again or by cutting & pasting them to another document, saving that document in RTF format, closing the document then re-opening it and copying back to your original document.

If it's the former, you'll need to:
• turn off any 'around' text wrapping;
• split the table wherever there's a disjunction of the alignments; and
• make sure all the split tables have the same alignment, non-wrap settings and indents.
Once you've done that, you can re-join them. To delete the intervening paragraphs between the tables so you can re-join them is no more difficult than selecting them and pressing Delete.
Thanks for the quick response.

I don't believe that this one was copied from another table, but I can't be 100% sure as I am working on several of these currently. The initial document was created from a blank table, and the text was copied from the Indesign document I am replicating. Usually when this issue happens, I find I need to start over from the beginning by creating a new table, and I copy the text from each individual cell's contents from the original document, but not the cells/rows themselves. I use the original document to check the row heights/spacing etc. and manually enter those into the new table.

The Text Wrap is turned off (it's turned off on all of these documents; when I turn it on, it doesn't flow into the 2 columns of the page. Don't know if there is a way to make it flow into the 2 columns with Text Wrap turned on)

My mistake on deleting the paragraph space; I am using a mac keyboard and the 'delete' key is really the 'backspace' key. If I use the other 'delete' key below the 'help' key, it works.

Saving the table to RTF did not seem to have any effect. I will try to see if splitting the table apart will help once this problem occurs. Thanks again.
Reply With Quote
  #6  
Old 06-27-2014, 06:35 AM
Cosmo Cosmo is offline Complex table issues - cells shift Windows Vista Complex table issues - cells shift Office 2007
Competent Performer
Complex table issues - cells shift
 
Join Date: Mar 2012
Posts: 240
Cosmo is on a distinguished road
Default

No luck so far in joining the tables. Once I get a section looking good and try to join them, the cells shift again.

I did try converting the table to text, but I don't know if I can convert it back to a table easily. Each row has differing #s of cells, and I would have to convert single rows, or a few rows at a time. (If I convert it to a 1 column table, the resulting table looks ok in print and outline view)

I will try recreating the table from the start again, one section at a time, copying the text from the original Indesign document. I will check the outline view occasionally as I am working to see if I notice any issues. Once I have each section set, I will try joining them to see if it works.


Edit: After converting the table to text, I converted the first 2 rows to a single column table, then when I selected the text for the next row and converted them to a 5 column table, that row was shifted from the first 2 rows.
Reply With Quote
  #7  
Old 06-27-2014, 06:39 AM
macropod's Avatar
macropod macropod is offline Complex table issues - cells shift Windows 7 32bit Complex table issues - cells shift Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Can you attach a document to a post with the table concerned (delete anything sensitive)? You do this via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen. I'll take a look at it tomorrow (it's 11:40pm here).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 06-27-2014, 06:49 AM
Cosmo Cosmo is offline Complex table issues - cells shift Windows Vista Complex table issues - cells shift Office 2007
Competent Performer
Complex table issues - cells shift
 
Join Date: Mar 2012
Posts: 240
Cosmo is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Can you attach a document to a post with the table concerned (delete anything sensitive)? You do this via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen. I'll take a look at it tomorrow (it's 11:40pm here).
Attached are 2 documents, the first one (Table1.doc) is the original table posted. The second one (Table2.doc) is the results I mentioned above after I converted one of the tables to text. (the first 2 paragraphs were converted back to a 1-column table, the next row was converted from the next 5 paragraphs)

I appreciate any insight that you can give me. I certainly feel like I am much closer to solving this, or at the very least, being able to manage the issue when it occurs.
Table 1.doc

Table 2.doc

I'll post the results I have later today after I experiment with the tips you have given me if I have any success.
Reply With Quote
  #9  
Old 06-27-2014, 01:32 PM
Cosmo Cosmo is offline Complex table issues - cells shift Windows Vista Complex table issues - cells shift Office 2007
Competent Performer
Complex table issues - cells shift
 
Join Date: Mar 2012
Posts: 240
Cosmo is on a distinguished road
Default

Well, I spent the day carefully recreating the table in segments, and everything was working well until the very end (again). As I got around to the final tweaks, the tables started shifting again

I tried then splitting the table again and then rejoining it but that didn't work either (the rows shift once I combine the table segments.)

Also, I realized that the shifting that is visible on the Outline view is due to the cell left margins (when the text is included, it is noticable that the rows shift so that the text in the first cells all lines up.). So I am assuming that what was seen on the Outline viw wasn't a symptom or cause to the issue.

I'm giving up on this issue for today, I'll reattack it on Monday (assuming I haven't quit or jumped in front of a bus by then)
Reply With Quote
  #10  
Old 06-27-2014, 10:34 PM
macropod's Avatar
macropod macropod is offline Complex table issues - cells shift Windows 7 32bit Complex table issues - cells shift Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

A significant part of the issue you're having is that your table appears to be comprised of tables cut & pasted into Word with a variety of Table Styles, each with their own alignments, etc. The following macro should be able to clean them up.
Code:
Sub RepairTbl()
Dim i As Long, j As Long, Tbl As Table
Dim pWdth As Single, sCWdth As Single, bkClr As Long
With ActiveDocument
  Set Tbl = .Tables(1)
  With Tbl
    .AllowAutoFit = False
    .Cell(1, 1).PreferredWidthType = wdPreferredWidthPoints
    pWdth = .Cell(1, 1).PreferredWidth
    With .Range
      On Error Resume Next
      For i = .Cells.Count To 1 Step -1
        If .Cells(i).ColumnIndex = 1 Then
          Tbl.Split Tbl.Range.Cells(i).RowIndex
        End If
      Next
      On Error GoTo 0
    End With
  End With
  For Each Tbl In .Tables
    With Tbl
      .AllowAutoFit = False
      With .Rows
        .Alignment = wdAlignRowLeft
        .LeftIndent = 0
        .WrapAroundText = False
      End With
    End With
  Next
  For i = 1 To .Tables.Count
    sCWdth = 0
    With .Tables(i)
      .AllowAutoFit = False
      .PreferredWidthType = wdPreferredWidthPoints
      .PreferredWidth = pWdth
      With .Range
        If .Cells.Count = 1 Then
          bkClr = .Cells(1).Shading.BackgroundPatternColorIndex
        End If
      End With
      .Style = "Table Normal"
      With .Range
        For j = 1 To .Cells.Count
          sCWdth = sCWdth + .Cells(j).Width
        Next
        If sCWdth <> pWdth Then
          For j = 1 To .Cells.Count
            .Cells(j).Width = .Cells(j).Width * pWdth / sCWdth
          Next
        End If
        If .Cells.Count = 1 Then
          If bkClr <> 0 Then .Cells(1).Shading.BackgroundPatternColorIndex = bkClr
        End If
      End With
    End With
  Next
  While .Tables.Count > 1
    .Tables(1).Range.Characters.Last.Next.Select
    Selection.Delete
  Wend
  With .Tables(1)
    .Borders.Enable = True
    .Rows.Alignment = wdAlignRowCenter
  End With
End With
End Sub
PS: Cut & paste the problem table to another document for processing. Once processed, you can copy it back to the source document.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 06-30-2014, 10:48 AM
Cosmo Cosmo is offline Complex table issues - cells shift Windows Vista Complex table issues - cells shift Office 2007
Competent Performer
Complex table issues - cells shift
 
Join Date: Mar 2012
Posts: 240
Cosmo is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
A significant part of the issue you're having is that your table appears to be comprised of tables cut & pasted into Word with a variety of Table Styles, each with their own alignments, etc. The following macro should be able to clean them up.
...
PS: Cut & paste the problem table to another document for processing. Once processed, you can copy it back to the source document.
Thanks again for your continued assistance (and somewhat superhuman patience). I tried running your code on the table I had created on Friday, and it had an error at line 48 (.Cells(j).width = .Cells(j).width * pWdth / sCWdth). I used a variable to set the value, and the error did not occur, but the result is still problematic (many rows are not the correct length, and if I try to adjust them, the rest of the rows shift more).

The file I created Friday had no tables or cells that were copied and pasted (each table section was from a brand new created table); the only items copied was the text from the original source document (InDesign). I spent most of the day meticulously creating and adjusting each table. I'm attaching that file if you want to look at that (I cleared the contents of the cells). This is where I had gotten to when the problems started reoccurring. When I tried to join the last 2 tables, the cells in the last table shift again. They are correct before the tables are joined. Any editing after joining the tables compounds the shifting cells.

Many rows (and cells) require different cell margins (these were set manually in the cell margins dialog, not by cutting and pasting), and that appears to me to be what was causing the shifting in the Outline view, don't know if that has anything to do with the different table styles you mentioned.
Attached Files
File Type: docx Table3.docx (38.8 KB, 11 views)
Reply With Quote
  #12  
Old 06-30-2014, 01:53 PM
Cosmo Cosmo is offline Complex table issues - cells shift Windows Vista Complex table issues - cells shift Office 2007
Competent Performer
Complex table issues - cells shift
 
Join Date: Mar 2012
Posts: 240
Cosmo is on a distinguished road
Default

Another interesting development, a coworker was able to adjust the table borders easily in Word 2013 (I'm using 2007). She just selected the border on the shifted cells, dragged it into position, and it didn't move any of the other cells.

BUT the resulting file does not show up properly in 2007 or 2010. The cells are still shifted when opened in these versions (and continue to shift with any other adjustment).

I was able to have minor success in removing the left cell margin from some of the affected cells/rows, then reapplying it, and in some cases that fixed that row. but it doesn't seem to be consistent. Also, I found that when this issue occurs, it increases the table width past 100% on each edit, which I can then reset. Unfortunately, the rows that are shifted are also set to 100%, and are wider than the actual table.
Reply With Quote
  #13  
Old 06-30-2014, 05:28 PM
macropod's Avatar
macropod macropod is offline Complex table issues - cells shift Windows 7 32bit Complex table issues - cells shift Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Cosmo View Post
I tried running your code on the table I had created on Friday, and it had an error at line 48 (.Cells(j).width = .Cells(j).width * pWdth / sCWdth). I used a variable to set the value, and the error did not occur, but the result is still problematic (many rows are not the correct length, and if I try to adjust them, the rest of the rows shift more).

The file I created Friday had no tables or cells that were copied and pasted (each table section was from a brand new created table); the only items copied was the text from the original source document (InDesign). I spent most of the day meticulously creating and adjusting each table. I'm attaching that file if you want to look at ...
The problem is due to having multiple tables in the document you ran the macro on. As noted in the PS quoted in your previous reply, you need to copy the table to a separate document for processing.

PS: Please don't quote entire posts replied to - just the relevant parts, if need be. Anything more just adds clutter.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Complex table issues - cells shift Word 2007 Table - Shift Cells INDYBUG Word Tables 1 09-29-2013 05:47 PM
How to make rows or cells shift down automatically rfrontz Excel 1 04-16-2013 03:26 AM
Complex table issues - cells shift How to make cells shift down automatically iffy Excel 7 04-15-2013 08:06 AM
Counting cells with multiple complex criteria TishyMouse Excel 12 12-06-2012 05:05 AM
Complex table issues - cells shift Word 2007 Tables - Shift cells backwards one place bloodge1 Word Tables 3 08-28-2012 10:11 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:42 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft