Finding the End of the Cell

J

Jerry

In Word 2000, is there a way to use the Find and Replace dialog to find the
last character(s) in a table cell? For example, if I wanted to find all table
cells containing text that ended in the letter s...
Thanks,Jerry
 
D

Doug Robbins - Word MVP

I do not thing that you can do it with the Find and Replace dialog. It can
however be done using VBA. Best if you tell us what you want to do when you
find such cells so that we can give you an appropriate response that
addresses that.

--
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
 
J

Jerry

Doug,
Here's more information: I see a lot of tables that, for a variety of
reasons, have one or more characters that need to be deleted at the end of
some (not necessarily all) cells. In the one I'm working on now, I'd like to
be able to remove "/ " (slash space) whenever it appears at the end of a cell
(and from nowhere else).
Jerry
 
D

Doug Robbins - Word MVP

The following code in a macro will ask you to enter the character that is at
the end of the cells that you want to delete and then do all of the
deletions for you::

Dim delchar As String
delchar = InputBox("Enter the character at the end of the cells that you
want to delete.")
Dim cellrange As Range
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(findText:=delchar, Forward:=True, Wrap:=wdFindStop) =
True
If Selection.Information(wdWithInTable) Then
Set cellrange = Selection.Cells(1).Range
cellrange.End = cellrange.End - 1
If Selection.Range.End = cellrange.End Then
Selection.Range.Delete
End If
End If
Loop
End With



--
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
 

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