Re: selecting a variable number of rows in a table by Gil
Gil
Tue Feb 22 00:24:36 CST 2005
Thank you again Jez :)
I tried it and see how it works. In my particular case, I want to retain
the table format with the pasted material. But I will tuck away the info
you gave as needs do re-appear. I'm pretty happy with the answer as it now
stands.
:) Cheers.
Gil
"Jezebel" <warcrimes@whitehouse.gov> wrote in message
news:uCOhTaJGFHA.2032@tk2msftngp13.phx.gbl...
> Try this --
>
> Dim pStart as long
> Dim pEnd as long
>
> With ActiveDocument
> With .Tables(1)
> pStart = .Cell(3,1).Range.Start
> pEnd = .Cell(8,9).Range.End
> End With
> .Range.InsertAfter .Range(pStart,pEnd).Text
> End with
>
>
>
> :
>
>
>
> "Gil Carter" <emr.RemoveThisWord@surewest.net> wrote in message
> news:%23fAqlNJGFHA.464@TK2MSFTNGP15.phx.gbl...
>> Thanks Jez, ...
>> The code seems to be working ok. I am working with tables It seems to
>> be giving correct numbers regardless of the number or lines in each cell.
>>
>> How would you recommend copying cells A3 up to but not including H9, so
>> as to paste or place them at the bottom of the file?
>>
>> ???
>> Dim tablePart As Range
>> Set tablePart = ActiveDocument.Tables(1).Cell(1, 3 - 9, 8).Range
>> Selection.EndKey Unit:=wdStory
>> Selection.TypeText Text::=tablePart
>> :)
>> tia
>> Gil
>>
>> "Jezebel" <warcrimes@whitehouse.gov> wrote in message
>> news:O2lOkeIGFHA.1260@TK2MSFTNGP12.phx.gbl...
>>> Make sure you're not getting mixed up between page columns and table
>>> columns. If you're within a table you can use Selection.RowIndex and
>>> Selection.ColumnIndex to work out where you are.
>>>
>>> And as a general principle, avoid using the Selection object in macros.
>>> It's always better (and easier!) to use Range objects.
>>>
>>>
>>>
>>>
>>> "Gil Carter" <emr.RemoveThisWord@surewest.net> wrote in message
>>> news:O8Cnr3HGFHA.3812@TK2MSFTNGP15.phx.gbl...
>>>> Thanks again, Jez
>>>> I think I've got it ... from the info you gave another earlier today.
>>>>
>>>> I used:
>>>> Col = Selection.Information(wdEndOfRangeColumnNumber)
>>>> Row = Selection.Information(wdEndOfRangeRowNumber)
>>>> Dim fga As String
>>>> fga = Row - 4
>>>> Selection.MoveUp Unit:=wdLine, Count:=1
>>>> Selection.SelectRow
>>>> Selection.MoveUp Unit:=wdLine, Count:=fga, Extend:=wdExtend
>>>>
>>>> after I used a find function to locate the "Ongoing Meds" string in the
>>>> table.
>>>>
>>>> :)
>>>> Gil
>>>>
>>>>
>>>> "Gil Carter" <emr.RemoveThisWord@surewest.net> wrote in message
>>>> news:e7lsgkHGFHA.4004@tk2msftngp13.phx.gbl...
>>>>> Aha ... I see some of my answer in Jez's response to a question a few
>>>>> hours ago.
>>>>> :)
>>>>> Gil
>>>>>
>>>>> "Gil Carter" <emr.RemoveThisWord@surewest.net> wrote in message
>>>>> news:%23b8zedHGFHA.3928@TK2MSFTNGP09.phx.gbl...
>>>>>> Hi All,
>>>>>>
>>>>>> I desire to select a variable number of rows in a table between two
>>>>>> strings of text. The first cell to be selected is always Cell Column
>>>>>> A, Row 3. Cell A aobve the last row to be selected reliably has the
>>>>>> words "Ongoing Meds". The number of rows to be selected varies. The
>>>>>> following is a table with borders, but I do not know if it will show
>>>>>> in a newsgroup. I am using Word 2003, Windows XP.
>>>>>>
>>>>>> Note: this table usually adds some information at each visit
>>>>>> http: //www.coremedicalconcepts.com
>>>>>>
>>>>>> PMH: HBP, PVD, spinal stenosis C4-5, BPH, hyperlipidemia,
>>>>>> aortoiliac bypass '83, hernia '87, femoral thromboarterectomy and
>>>>>> fem-pop '91 Occupation:
>>>>>>
>>>>>> FH: unknown
>>>>>>
>>>>>> Problem Progress List
>>>>>> 09-01-04
>>>>>> 3-16-03
>>>>>> 3/28/02
>>>>>> 03/15/01
>>>>>> 05/10/00
>>>>>> 02/21/00
>>>>>> 09/03/99
>>>>>> 6/98
>>>>>>
>>>>>> cholesterol - HDL
>>>>>> 150-61
>>>>>> 161-58
>>>>>> 166-54
>>>>>> 172-47
>>>>>> 172-48
>>>>>> 206-53
>>>>>> 253-47
>>>>>> 183-56
>>>>>>
>>>>>> LDL -- trigly
>>>>>> 74-73
>>>>>> 85-89
>>>>>> 91-106
>>>>>> 104-106
>>>>>> 105-96
>>>>>> 135-91
>>>>>> 185-103
>>>>>>
>>>>>>
>>>>>> ' " weight ®
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> pap-mammogram-PSA
>>>>>>
>>>>>> CBC ESR CMP UA
>>>>>>
>>>>>> TSH (nl: 0.4-5.5)
>>>>>>
>>>>>> colonoscopy
>>>>>>
>>>>>> DEXA
>>>>>> --- ; 0.6
>>>>>>
>>>>>> wnl
>>>>>>
>>>>>> wnl
>>>>>>
>>>>>> -
>>>>>>
>>>>>> -
>>>>>> -- 0.75
>>>>>>
>>>>>> wnl
>>>>>>
>>>>>> wnl
>>>>>>
>>>>>> -
>>>>>>
>>>>>> -
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> other
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Ongoing Meds
>>>>>> Past meds used & notes about them below:
>>>>>>
>>>>>> vytorin 10-40 1 q hs
>>>>>> x 11-24-04 formulary change; lipitor 40 mg q hs ; x 8/20/01; 20
>>>>>> mg q hs ; x 02/21/00 qs 6 mos; previously, 10 mg q hs x 11/99; before
>>>>>> that, pravachol and lescol
>>>>>>
>>>>>>
>>>>>> table truncated ... /// ...
>>>>>>
>>>>>> tia,
>>>>>> :)
>>>>>> Gil
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>