Select table column selects misaligned cells

R

Robert

Thanks to you MVPs for the loads of help you give day in and day out. I
have not posted in microsoft.public.* before, but I search here
whenever I run into difficulty, and am seldom disappointed.

This time, my searches have been fruitless, probably because any
relevant keywords I can think of are not sufficiently unique. I'm sure
someone must have answered this before:

Sometimes when I select a range of cells in a table (either by clicking
above a column or by dragging through the cells), the resulting
selection is "misaligned". For example, a cell that appears to be
perfectly in the range may not be selected, while a cell appearing
outside the desired range is selected instead.

When this symptom results from non-uniform cell widths in a column, it
makes sense to me, but it sometimes occurs when the cells are perfectly
equal.

"Fixing" the problem sometimes requires deleting the rows that don't
align (although, as I said, the cells may appear to align perfectly).

I have Word 97 SR-2 running in XP.

Your time is greatly appreciated.

Robert
 
S

Suzanne S. Barnhill

Sometimes this can happen, I suspect, when rows have been merged and then
resplit and Word loses the plot.
 
R

Robert

Thanks Suzanne. Your advice to others has been a lot of help to me, and
I occasionally even add your name to my search criteria!

I suppose this doesn't sound like a serious problem, but I use many
tables to present procedures in manuals. Without actually inspecting my
selection, I can never be confident that deleting the contents of a
long column will not accidentally delete the wrong cell on another
page.

Selection misalignment can get rather bizarre in a complex table, and
adjustments to such a table sometimes devolve into a silly mess of
tinkering with individual cells, one-by-one. I can accept the
consequences of having a single cell spanning five smaller columns
below it, but it gets frustrating when temporarily splitting that
single cell into five exactly matching the ones below does not help, or
even makes things worse.

If you or anyone else can shed more light on this, I would be most
grateful.

BTW, is "losing the plot" a reference to how Word actually functions,
or is it akin to saying Word "goes off the deep end"?

Many thanks!
Robert Harris-Stoertz
 
G

Greg

Robert,

I think you know that just because a column looks aligned if there are
merged and split cells in the table the column index number of the
selected cells may not be the same.

You might try a macro something like this to ensure that you delete
text in the desired column index regardless of the alignment:

Sub Test()
Dim oCell As Word.Cell
Dim oIndex As Integer
oIndex = InputBox("Enter the column range you want to delete")
'or
'oIndex = Selection.Cells(1).ColumnIndex
For Each oCell In ActiveDocument.Tables(1).Range.Cells
If oCell.ColumnIndex = oIndex Then
oCell.Range.Delete
End If
Next
End Sub
 
R

Robert

Thank you Greg.

It did not occur to me to try a VBA approach. I can see that
experimenting with it should at least help me understand the column
index numbers you, Suzanne, and others have referred to. Aside from
using a creative macro, I don't know any other way of even knowing the
column index number of a cell, if counting from the left doesn't work.
Unfortunately, it looks to me like the macro above will do the same
thing as deleting a misaligned selection--if cell 2,4 (row, column) is
perfectly aligned so it appears to be part of column 3, using your
macro to delete column 4 appears to incorrectly delete cell 2,4. (I say
"incorrectly" because no user will have known that it is not a part of
column 3, so the text in it should not be deleted.) Perhaps I am
missing something.

Just to make sure we are clear on this--I can understand that a column
selection may act odd after cells are shifted left/right,
differently-sized, or when there are different numbers of cells in
different rows. I'm okay with that. My problem is understanding and
dealing with a misaligned column selection when each row has the same
number of cells, all columns are the same width, and all the rows have
the same indent and column spacing. This has burned me more than once.

Thanks to all,

Robert Harris-Stoertz
 
G

Greg

Robert,

I think the best thing might be a macro that confirms each cell in a
selected section is in fact a member of the same group. That group be
a group with a common ColumnIndex number. I haven't tried it yet so I
don't know if it can be done. Will try to look at it tonight.

Greg
 
R

Robert

Very nice!

Whether that works or not for my immediate problem, it looks like a
must-have for anyone doing serious work with tables. I'll download that
tomorrow.

Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top