i have programmed a working script that makes new tables and formats it the way we need it and partially populates it with data now i have used pieces of code like this Selection.MoveRight unit:=wdCharacter, Count:=1 Selection.MoveRight unit:=wdCharacter, Count:=(UBound(HulpGieken2) + 1) * (UBound(Hoeken2) + 1), Extend:=wdExtend Selection.Cells.Merge now someone told me this way (selection.moveright and such) of coding is sensitive to error he suggested using something like table.Range.Select but how do i select for example from cell(2,2) to cell(6,8) thanks
i'm using word 2003 "bert" wrote: > i have programmed a working script that makes new tables and formats it the > way we need it and partially populates it with data > > now i have used pieces of code like this > Selection.MoveRight unit:=wdCharacter, Count:=1 > Selection.MoveRight unit:=wdCharacter, Count:=(UBound(HulpGieken2) + 1) * > (UBound(Hoeken2) + 1), Extend:=wdExtend > Selection.Cells.Merge > > now someone told me this way (selection.moveright and such) of coding is > sensitive to error > he suggested using something like table.Range.Select but how do i select for > example from cell(2,2) to cell(6,8) > > thanks
Dim myrange as Range With ActiveDocument.Tables(1) Set myrange = .Cell(2, 2).Range myrange.End = .Cell(6, 8).Range.End End With Then, if you really need to select those cells myrange.Select -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "bert" wrote in message news:8C3E781B-1835-4096-B05B-B5D6E9804D95@microsoft.com... >i have programmed a working script that makes new tables and formats it the > way we need it and partially populates it with data > > now i have used pieces of code like this > Selection.MoveRight unit:=wdCharacter, Count:=1 > Selection.MoveRight unit:=wdCharacter, Count:=(UBound(HulpGieken2) + 1) > * > (UBound(Hoeken2) + 1), Extend:=wdExtend > Selection.Cells.Merge > > now someone told me this way (selection.moveright and such) of coding is > sensitive to error > he suggested using something like table.Range.Select but how do i select > for > example from cell(2,2) to cell(6,8) > > thanks