How to select a portion of a table ?

  • Thread starter Thread starter dpap
  • Start date Start date
D

dpap

Hi,
I want to select, with VBA code in a macro, all the cells from
cell(5,3) to cell(12,7)
How can I do this ?
thanks in advance
 
Hi dpap,

It is not possible to select other than a rectangular range in Word. The
following will select such a range that starts with the cells nominated.
No cells in columns 1 and 2 or in any columns greater than 7 will be
selected however:

Dim myrange As Range

Set myrange = Selection.Tables(1).Range
myrange.Start = Selection.Tables(1).Cell(5, 3).Range.Start
myrange.End = Selection.Tables(1).Cell(12, 7).Range.End
myrange.Select

*If you're seeing this through Rubin's crappy web site, you should know
that he does not have my permission to include this message on his website.
I own the copyright, and I grant a license to Microsoft, Google and the
usenet community. I deny Rubin the right to repost my message on his site.*

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
Back
Top