table column line up problem

S

Staroslav

Sometimes tables in Word get messed up and the columns don't line up
properly. Does any one know of a quick way to fix that problem? At this
point, I either have to recreate a portion or the whole table or fiddle
around with lines of columns until they "click" into place.
This happens more often than I wish, so any help will be greatly appreciated!
 
H

Helmut Weber

Hi Staroslav,

the question is, what width sould the cell have?

This one adjusts all cells to the first cell in a column,
hoping, the first cell has the right width.
Other ways of coding might be preferable,
if higher performance is necessary.
---
Dim c As Long ' column
Dim r As Long ' row
Dim w As Single ' width
With ActiveDocument.Tables(1)
For c = 1 To .Columns.Count
w = .Cell(r, 1).Width
For r = 2 To .Rows.Count
.Cell(r, c).Width = w
Next
Next
End With
---

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
 
S

Staroslav

Thank you Helmut, this doesn't quite do it, but it gave me an idea that
should work. I need to write a macro that identifies the problem cell
(current selection), and sets its width as the cell right above it, which
should be the good cell. I guess cell index should be used to avoid mix up.
I'll try working on it.
vs
 
Top