No Column.Range?

A

Anon Canuck

How does one set a Range object to be a single column in a
table?

Thanks in advance.
 
J

Jezebel

You can't unless the table has only one column. A range is a stretch of
document defined by a single pair of start and end points. A column is in
effect a collection of (non-contiguous) ranges -- namely the cells within
it.
 
H

Helmut Weber

Hi,
if it must be, select the column and
define a range containing the selection.
Dim r As Range
ActiveDocument.Tables(1).Columns(1).Select
Set r = Selection.Range
Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word XP, NT 4.0
 
J

JGM

Hi Anon,

Yes, as Helmut wrote, you can define a range as being a column.
But aware that in actual fact, as Jezebel wrote previous to Helmut, your
range starts with the first character in the first cell of the selected
column and ends with the last character of the last cell in the selected
column, and it includes everything in between, i.e. all the cells between
these two points.

Try the following code on a 6x8 table to see the impact of the range object
applied to a column:
'_______________________________________
Dim r As Range
ActiveDocument.Tables(1).Columns(4).Select
Set r = Selection.Range
Selection.HomeKey wdStory
r.Font.Bold = True
'_______________________________________

If it was necessary to bold only the selected "range", then you have to use
the selection object, as in:
'_______________________________________
ActiveDocument.Tables(1).Columns(4).Select
Selection.Font.Bold = True
'_______________________________________

This is why you cannot assign a bookmark to a column and then do a
SUM(bookmark) and expect the right result if there are numbers in adjacent
cells. The column bookmark is like the range object.

Cheers!
 

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