Select cells in a table for a merge

W

whonow

Hi all,

What i am trying to do is from vba merge some (not all) of the cells
in a column. I have found the merge method of a cells collection, but
how do i get a cells collection of say 3 of the cells in a column of
say 8 cells. I don't want to select the entire rows for merging, just
the 3 out of 8 cells in the first column.

Any help would be appreciated

Many thanks
 
D

DA

Use something like the following (merges first three
cells of column 2 in the first table of the active
document):

----
With ActiveDocument.Tables(1)
.Cell(1, 2).Merge MergeTo:=.Cell(3, 2)
End With
----

I suggest you wrap the above into a check routine to
ensure you're not trying to operate on non-existent cells
or tables.

Hope that helps,
Dennis
 

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