View Single Post
 
Old 08-18-2019, 08:50 PM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Windows 10 Office 2013
Competent Performer
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 190
Cendrinne is on a distinguished road
Smile Help to spead up macro - Find and Replace in Tables, Cut Paste Next Cells

I have this macro that works for me, the only thing, if I have 5 pages long of table(s), it takes for ever to do it 1 by 1 on each $ or %.

In a nut shell, I need to find $ or % in a table, then move it to the next cell which I've already created an empty column.
I wish I could show an example of a table picture, but I don't know how.

Normally Find and Replace, Execute All at once. What can I do to have it do it all at once?


This is my macro.....
Sub Change_Value_to_Next_Cell_GOOD()
'33
'Change_Value_to_Next_Cell Macro
' I can change the % or $ or any string of text and have it copy, cut, and paste to the next cell.
' Alt+2
'
Dim sText As String
sText = InputBox("Enter text to move cell")
Selection.Find.ClearFormatting
With Selection.Find
.Text = sText
.Wrap = wdFindStop
End With
Do While Selection.Find.Execute
If Selection.Information(wdWithInTable) = True Then
Selection.Copy
Selection.Cut
Selection.MoveRight Unit:=wdCell
Selection.PasteAndFormat (wdFormatOriginalFormatting)
Selection.Move Unit:=wdCell, Count:=1
End If
Loop
MsgBox " You're Selection is Done in the Active Document!"
On Error GoTo 0

End Sub


Any insight would be appreciated.


Oh an added bonus, if I can find multiple values at once, such as if found $ or %, or another value, cut move to next cell, then paste.

P.S.1 Reason we must move the $ or % to the next cell, is because that is what we do in our French documents.
P.S.2 My table example to test a macro, has 5 columns of numbers only, with an extra empty columns on each columns to move in the $.

Thanks in advance


Cendrinne

Last edited by Cendrinne; 08-19-2019 at 08:45 AM. Reason: Added p.s. 2
Reply With Quote