Selection from insertion point to end of column in table

F

Fred Holmes

Word 2000

I'm looking for a keystroke shortcut that will select text from the
insertion point to the bottom of the current column in a Word Table.

So that I can select that text and then perform a find/search that
searches only the remainder of that column for a (another) hit in that
column.

The table is a 300-page-long list of acronyms (two columns, left
column for the acronym, right for the definition), so the mouse
movements I know of are very inefficient for getting to the bottom of
the current (generally the left) column.

Macro code would be a fine solution, if no built-in keystroke shortcut
exists. I can add a keystroke shortcut to the macro.

Thanks for any help.

Fred Holmes
 
J

Jay Freedman

Fred said:
Word 2000

I'm looking for a keystroke shortcut that will select text from the
insertion point to the bottom of the current column in a Word Table.

So that I can select that text and then perform a find/search that
searches only the remainder of that column for a (another) hit in that
column.

The table is a 300-page-long list of acronyms (two columns, left
column for the acronym, right for the definition), so the mouse
movements I know of are very inefficient for getting to the bottom of
the current (generally the left) column.

Macro code would be a fine solution, if no built-in keystroke shortcut
exists. I can add a keystroke shortcut to the macro.

Thanks for any help.

Fred Holmes

There isn't any built-in keystroke, but you can assign one. Open Tools >
Customize and click the Keyboard button. In the Commands tab, click Table in
the Categories list and click TableSelectColumn in the Commands list. Click
in the "Press new shortcut key" box and press the combination you want to
use, then click the Assign button. (By default the assignment will go into
the Normal.dot template, but you can choose to store it in the document
itself by changing the dropdown before clicking Assign.)

By the way, I hope you don't have a lot of trouble with one table covering
300 pages. Historically, Word has been very unhappy dealing with long
tables. See http://word.mvps.org/FAQs/TblsFldsFms/FastTables.htm for some
hints.
 
F

Fred Holmes

But it's TableSelectTheRemainderOfTheColumn() or some such that I
want. Selecting the entire column is already available. I want to be
able to search for successive find hits in the column. (I know how to
assign a keystroke shortcut for code that already exists.)

The long, 300 page table doesn't seem to be a problem so far. But
I've got 1 GB of RAM in my 1.5 GHz AMD computer. The conversion
process from text to table took about 10 minutes. But searching the
table is fast.

v/r

Fred Holmes
 
F

Fred Holmes

When searching a column (that is selected text) in a table, when the
first "hit" occurs, the column is no longer selected text. The "hit"
is now the selected text. "Find Next" then searches the current
selected text, the first hit, and then asks to search the remainder of
the document. I don't want to search the remainder of the document,
but rather search the remainder of the column. So I now have to
select the remainder of the column. How? (Am I missing something?)

I lose the restricted search, restricted to the selected text, when
the hit occurs. I don't want to start over from the beginning (top)
of the column, which is what happens if I re-select the entire column.

Fred Holmes
 
S

Suzanne S. Barnhill

Okay, I see your point. But I believe you may find that your initial
assumption is flawed. I have a large table of names and addresses. The name
column includes some that contain the initial S., and the address column
contains addresses containing S. (abbreviation for South). If I select the
address column and search for "S.," each Find Next finds the text only in
the initially selected column, ignoring those in other columns. Similarly,
if I select the Type column (which contains a code--M, P, S, L, X, and so
on) and search for S, Word finds only the S's in that column.
 
J

Jay Freedman

Hi Fred,

OK, I think I have a better handle on what you need. It does require a
macro, and even that has to jump through some hoops. The problem is that
Word doesn't have any good way to define a search range that consists of
part of a column. It treats a search on a whole selected column as a special
case that can't be duplicated exactly in VBA.

In a macro, a range that starts at the cursor and goes to the end of the
table *must* contain both columns, working left-to-right and then down to
the next row. There just isn't any other way to describe it in code. So the
macro I wrote just searches forward from the current cursor location, and
each time it finds a 'hit' it asks which column it's in. If the hit isn't in
column 1, then the search continues.

The one thing you need to be careful about is that, if you restart the macro
with the cursor anywhere in the cell that contains the previous hit, it will
reselect that hit. (The reason is that the end-of-cell marker for that cell
is within the search range, which effectively includes the whole cell in the
range.)

Private SearchTerm As String

Sub FindInColOne()
Dim myRange As Range

If Not Selection.Information(wdWithInTable) Then
Exit Sub
End If

SearchTerm = InputBox$( _
"Enter search term:", _
"Search in table", SearchTerm)
If SearchTerm = "" Then ' canceled
Exit Sub
End If

Set myRange = ActiveDocument.Range( _
Start:=Selection.Start, _
End:=Selection.Tables(1).Range.End)
' note this range includes both columns
With myRange.Find
.Text = SearchTerm
.Format = False
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = False

Do
.Execute
Loop Until (Not .Found) Or _
(myRange.Information( _
wdStartOfRangeColumnNumber) = 1)
If .Found Then
myRange.Select
End If
End With
End Sub
 

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