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
Gil Carter - 22 Feb 2005 00:54 GMT
Aha ... I see some of my answer in Jez's response to a question a few hours
ago.
:)
Gil
> Hi All,
>
[quoted text clipped - 88 lines]
> :)
> Gil
Gil Carter - 22 Feb 2005 01:29 GMT
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
> Aha ... I see some of my answer in Jez's response to a question a few
> hours ago.
[quoted text clipped - 93 lines]
>> :)
>> Gil
Jezebel - 22 Feb 2005 02:38 GMT
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.
> Thanks again, Jez
> I think I've got it ... from the info you gave another earlier today.
[quoted text clipped - 111 lines]
>>> :)
>>> Gil
Gil Carter - 22 Feb 2005 04:02 GMT
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
> 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
[quoted text clipped - 118 lines]
>>>> :)
>>>> Gil
Jezebel - 22 Feb 2005 04:25 GMT
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
> Thanks Jez, ...
> The code seems to be working ok. I am working with tables It seems to be
[quoted text clipped - 134 lines]
>>>>> :)
>>>>> Gil
Gil Carter - 22 Feb 2005 06:24 GMT
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
> Try this --
>
[quoted text clipped - 147 lines]
>>>>>> :)
>>>>>> Gil