Cannot access individual rows because table has vertically merged

P

Peter

I have a four column table where column 1 is the "key" and entries are by row. I want to locate a row by the value stored in column 1, then access the values in columns 3 and 4 of that row. Some rows however are split in columns 3 & 4 such that there are two or more rows. I guess word sees it as column 1 is merged over several rows. If I try to access the individual rows in column 3 that are associated with the value in row i of column 1 with .Rows(i).Cells(3) I get the error message in the subject. If I use .Columns(3).Cells(i), I get no error message but I have no way of knowing which row in column 1 it pertains to.
Does anyone have any ideas how to go about doing this?
 
K

Klaus Linke

Hi Peter,

If you have already located the "key" cell in column 1, you could just move
to the third column:
..Move Unit:=wdCell, Count:=2

It's true that Word treats the cells in other columns as "merged" if you
have split a cell in some column vertically.

To get the indices that Word uses:
numRow = Selection.Information(wdStartOfRangeRowNumber)
numCol = Selection.Information(wdStartOfRangeColumnNumber)

And to select that cell:
myTable.Cell(row:=numRow,column:=numCol).Select

BTW, what version do you use? If I follow your example in Word2002, I can't
even access columns any more ... that is, Columns(3).Cells(i) gives an
error message 5992 about "mixed cell widths", though all cells have the
same width :-(

Regards,
Klaus
 

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