View Single Post
  #5   Report Post  
Posted to microsoft.public.word.tables
[email protected] BrianHolfield@hotmail.com is offline
external usenet poster
 
Posts: 3
Default Find&Replace character before end-of-cell mark

On Sep 24, 1:32*am, "Doug Robbins - Word MVP"
wrote:
Use a macro containing the following code when the selection is in the table

Dim arng As Range
Dim i As Long, j As Long
With Selection.Tables(1)
* * For i = 1 To .Rows.Count
* * * * For j = 1 To .Columns.Count
* * * * * * Set arng = .Cell(i, j).Range
* * * * * * arng.End = arng.End - 1
* * * * * * If Right(arng.Words.Last, 1) = "A" Then
* * * * * * * * arng.Words.Last = Left(arng.Words.Last,
Len(arng.Words.Last) - 1)
* * * * * * End If
* * * * Next j
* * Next i
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

wrote in message

...
On Sep 22, 10:31 am, "Suzanne S. Barnhill" wrote: Unfortunately, MS has not (yet) provided any way to search for an
end-of-cell marker.


--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA


Yes, that much is clear. But isn’t there a programmatic approach? I
imagine saying: read the contents of a cell into variableX; right
truncate variableX by one character; paste variableX back into the
cell.


Thanks, Doug. Works beautifully.