Search & Replace

M

macropod

W2009?

--
Cheers
macropod
[Microsoft MVP - Word]


Pamelia Caswell via OfficeKB.com said:
I just tried searching for " face^10", "face ^10", and " ^10" in W2009. All
work with wild cards enabled. It selects only up to the end of cell
marker—probably because the marker cannot be manipulated. It also replaces
only up to the end of cell marker.

Thanks, Paul.

Pam
Hi Dean,

Works fine in Word 2000. It seems to be just another thing that took a backward step with later versions ...
Sorry, to clarify.
^10 does work but not on its own or with a space before.
[quoted text clipped - 20 lines]
What are the equivalent codes when using Search & Replace in tables?
.
 
P

Pamelia Caswell via OfficeKB.com

2007. Fingers slipped. And I'm very disappointed that ^10 doesn't work in
W2007.

Pam
W2009?
I just tried searching for " face^10", "face ^10", and " ^10" in W2009. All
work with wild cards enabled. It selects only up to the end of cell
[quoted text clipped - 14 lines]
 
J

Johann Swart

Graham Mayor posted a macro that clears tables of leading and trailing spaces.
Before I could put it to the test, DeanH wrote that he experienced failure
of this macro, which was then attributed to merged cells.
Doug Robbins then posted a macro to find merged cells, and then to manually
do whatever is required.
Both macros are certainly valuable and will help me a great deal; many
thanks Graham.
As my tables are riddled with merged cells, it will still require a
significant degree of "manual labour" to take care of merged cells
separately; hence my "one size..." (read "one macro") comment.
Again, sincere thanks. It certainly beats inspecting thousands of cells one
by one.
 
D

DeanH

Hi Johann. The revised macro with the "acell" works very well with merged
cells.
I have tested this with some very complex tables and no problems have been
noticed.
Graham - many thanks.
DeanH
 
J

Johann Swart

Suddenly the lights went on! Thanks Dean.

DeanH said:
Hi Johann. The revised macro with the "acell" works very well with merged
cells.
I have tested this with some very complex tables and no problems have been
noticed.
Graham - many thanks.
DeanH
 
D

David Turner

Graham Mayor said:
Good thinking - that would equate to

Dim oRng As Range
Dim oTable As Table
Dim acell As Cell
For Each oTable In ActiveDocument.Tables
With oTable
For Each acell In oTable.Range.Cells
Set oRng = acell.Range
oRng.End = oRng.End - 1
oRng.Text = RTrim(oRng.Text)
Next acell
End With
Next oTable

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Might be best to first check whether there is actually a space before the
end of cell marker to avoid unnecessary trimming.

Sub RemSpaceBeforeCellMarker()

Dim oRng As Range
Dim oTable As Table
Dim acell As Cell
For Each oTable In ActiveDocument.Tables
With oTable
For Each acell In oTable.Range.Cells
Set oRng = acell.Range
oRng.End = oRng.End - 1
If Right(oRng.Text, 1) = " " Then
oRng.Text = RTrim(oRng.Text)
End If
Next acell
End With
Next oTable

End Sub
 
G

Graham Mayor

David Turner said:
Might be best to first check whether there is actually a space before the
end of cell marker to avoid unnecessary trimming.

If there is no space nothing is trimmed, so the extra test would appear
superfluous?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
P

Peter Cooper

Thanks for the question and comments, as I have to do similar things. As I have sometimes done before, I have decided to convert the table to text, with tabs. Then Replace, and convert back to a table. The Replace behaviour seems more understandable and controllable then.
In Search & Replace (Find & Replace) where paragraph signs are involved, one
would use ^p in normal text or ^13 when using wild cards.
What are the equivalent codes when using Search & Replace in tables?
On Sunday, January 03, 2010 2:42 AM Graham Mayor wrote:
Paragraph breaks are paragraph breaks wherever they are in the document.
What *exactly* are you trying to do?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
On Monday, January 04, 2010 4:51 AM DeanH wrote:
Sorry, to clarify.
^10 does work but not on its own or with a space before.
As previously described in a previous posting, if you search for Wa^10 -
this will be found, But [space]^10 will not be found, any space will be found.
I have noticed Doug's macro and may have a play with that, any other ideas?
Thanks
DeanH


"DeanH" wrote:
On Monday, January 04, 2010 6:38 AM DeanH wrote:
Johann.
It was Macropod that suggested the ^10, and as you say this does not work
this [space]^10. I am still hoping for a solution.
What can work though if you are purely wanting to get rid of the superfluous
space before the cell end marker is to use the "old" trick of selecting the
text, align centre then align left (or left then centre). This will remove
all superfluous spaces, tabs, etc. at the end of paragraphs selected.
This works well, but obviously enusre that you select the text only not the
whole table, else the table itself will be aligned. I tend to select by
column, say columns 1 and 2 out of a 3-column table, do the trick, the n
select column 3 on its own, do the trick.
Not the best but does work well.
Lets see if anyone else can help with the Replace on [space] Cell End Marker.
Hope this helps
DeanH


"Johann Swart" wrote:
 

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